Spaces:
Running
Running
Download frontend/src/api.ts from PediaMedAI/MedCaseAgent: direct link, hf CLI and curl.
- Browser
- Download file 597 Bytes
-
https://huggingface.co/spaces/PediaMedAI/MedCaseAgent/resolve/main/frontend/src/api.ts
- Command line
-
hf download hf://spaces/PediaMedAI/MedCaseAgent/frontend/src/api.ts
-
curl -L -o api.ts https://huggingface.co/spaces/PediaMedAI/MedCaseAgent/resolve/main/frontend/src/api.ts
597 Bytes
| import type { Example, Project } from './types'; | |
| const isStatic = import.meta.env.VITE_STATIC_DATA === 'true'; | |
| async function read<T>(name: string, signal: AbortSignal): Promise<T> { | |
| const url = isStatic ? `./api/${name}.json` : `/api/${name}`; | |
| const response = await fetch(url, { signal }); | |
| if (!response.ok) throw new Error('Project content could not be loaded. Please try again.'); | |
| return response.json() as Promise<T>; | |
| } | |
| export const api = { | |
| project: (signal: AbortSignal) => read<Project>('project', signal), | |
| example: (signal: AbortSignal) => read<Example>('example', signal), | |
| }; | |