| 12345678 |
- const fetchCache = new Map<string, any>();
- export async function cachedFetchJSON(url: string, options?: RequestInit): Promise<any> {
- if (fetchCache.has(url))
- return fetchCache.get(url);
- const response = await fetch(url, options).then((r) => r.json());
- fetchCache.set(url, response);
- return response;
- }
|