export type DJAPIEndpoint = "/rp-articles"; export interface DJAPIResultMap extends Record { "/rp-articles": { slug: string; name: string }[]; } export type DJAPIResult = DJAPIResultMap[DJAPIEndpoint]; export default async function getDJAPI( hostUrl: string, endpoint: T, ): Promise { return await (await fetch(`${hostUrl}/api${endpoint}`)).json(); }