Download frontend/src/lib/api.js from Seth0330/qualifier: direct link, hf CLI and curl.
- Browser
- Download file 664 Bytes
-
https://huggingface.co/spaces/Seth0330/qualifier/resolve/main/frontend/src/lib/api.js
- Command line
-
hf download hf://spaces/Seth0330/qualifier/frontend/src/lib/api.js
-
curl -L -o api.js https://huggingface.co/spaces/Seth0330/qualifier/resolve/main/frontend/src/lib/api.js
664 Bytes
| /** Set when the frontend and API aren't same-origin (e.g. a standalone Azure Function App | |
| * backend) — empty string keeps existing relative-path behavior (HF Spaces, local dev). */ | |
| const API_BASE_URL = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, ''); | |
| export function apiUrl(path) { | |
| return API_BASE_URL && path.startsWith('/api') ? `${API_BASE_URL}${path}` : path; | |
| } | |
| /** Browser cookie session + tenant APIs require credentials on same-origin / proxied /api calls. */ | |
| export function apiFetch(input, init = {}) { | |
| const url = typeof input === 'string' ? apiUrl(input) : input; | |
| return fetch(url, { credentials: 'include', ...init }); | |
| } | |