MCPcopy Create free account
hub / github.com/fontsource/fontsource / fetchApiData

Function fetchApiData

website/app/utils/api.server.ts:1–12  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

1export const fetchApiData = async <T>(url: string): Promise<T> => {
2 const response = await fetch(url);
3
4 if (!response.ok) {
5 throw new Response(`Failed to fetch data from ${url}`, {
6 status: response.status,
7 statusText: response.statusText,
8 });
9 }
10
11 return response.json() as T;
12};

Callers

nothing calls this directly

Calls 2

jsonMethod · 0.80
fetchFunction · 0.50

Tested by

no test coverage detected