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