in src/server/lib/IDAPIFetch.ts [57:78]
Origin: getOrigin(stage),
},
body: payload ? JSON.stringify(payload) : undefined,
});
const APIFetch =
(idapiBaseUrl: string) =>
async <P extends ApiRoutePaths>(params: {
path: P;
queryParams?: IdApiQueryParams;
options?: RequestInit;
tokenisationParam?: ExtractRouteParams<P>;
}): Promise<any> => {
const tokenisedUrl = buildUrl(params.path, params.tokenisationParam);
const urlPath = params.queryParams
? addApiQueryParamsToPath(tokenisedUrl, params.queryParams)
: tokenisedUrl;
const response = await fetch(
joinUrl(idapiBaseUrl, urlPath),
params.options,
);
if (!response.ok) {