Spaces:
Running
Running
Download frontend/src/utils/api.js from Agmmm/valhalla: direct link, hf CLI and curl.
- Browser
- Download file 330 Bytes
-
https://huggingface.co/spaces/Agmmm/valhalla/resolve/refs%2Fpr%2F3/frontend/src/utils/api.js
- Command line
-
hf download hf://spaces/Agmmm/valhalla@refs/pr/3/frontend/src/utils/api.js
-
curl -L -o api.js https://huggingface.co/spaces/Agmmm/valhalla/resolve/refs%2Fpr%2F3/frontend/src/utils/api.js
330 Bytes
| const BASE = import.meta.env.VITE_API_URL || ""; | |
| export function apiUrl(path) { | |
| return `${BASE}${path}`; | |
| } | |
| export function wsUrl(path) { | |
| if (BASE) { | |
| return `${BASE.replace(/^http/, "ws")}${path}`; | |
| } | |
| const protocol = location.protocol === "https:" ? "wss:" : "ws:"; | |
| return `${protocol}//${location.host}${path}`; | |
| } | |