1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-11 00:54:26 +07:00
verdaccio-ui/src/utils/calls.ts
2019-07-09 10:48:00 +02:00

15 lines
482 B
TypeScript

import API from './api';
import { PackageMetaInterface } from 'types/packageMeta';
export interface DetailPage {
readMe: string | {};
packageMeta: PackageMetaInterface | {};
}
export async function callDetailPage(packageName): Promise<DetailPage> {
const readMe = await API.request<string | {}>(`package/readme/${packageName}`, 'GET');
const packageMeta = await API.request<PackageMetaInterface | {}>(`sidebar/${packageName}`, 'GET');
return { readMe, packageMeta };
}