Spaces:
Sleeping
Sleeping
Download frontend/src/utils/apiFetch.ts from zonszer/docker-space-fastapi-react: direct link, hf CLI and curl.
- Browser
- Download file 412 Bytes
-
https://huggingface.co/spaces/zonszer/docker-space-fastapi-react/resolve/main/frontend/src/utils/apiFetch.ts
- Command line
-
hf download hf://spaces/zonszer/docker-space-fastapi-react/frontend/src/utils/apiFetch.ts
-
curl -L -o apiFetch.ts https://huggingface.co/spaces/zonszer/docker-space-fastapi-react/resolve/main/frontend/src/utils/apiFetch.ts
412 Bytes
| import { BACKEND_URL } from "../constants"; | |
| export async function apiFetch( | |
| endpoint: string, | |
| options: RequestInit = {}, | |
| ): Promise<Response> { | |
| const url = `${BACKEND_URL}${endpoint}`; | |
| const defaultOptions: RequestInit = { | |
| credentials: "include", | |
| headers: { | |
| "Content-Type": "application/json", | |
| ...options.headers, | |
| }, | |
| ...options, | |
| }; | |
| return fetch(url, defaultOptions); | |
| } | |