Download frontend/src/utils/session.js from leowuming/rag: direct link, hf CLI and curl.
- Browser
- Download file 455 Bytes
-
https://huggingface.co/spaces/leowuming/rag/resolve/main/frontend/src/utils/session.js
- Command line
-
hf download hf://spaces/leowuming/rag/frontend/src/utils/session.js
-
curl -L -o session.js https://huggingface.co/spaces/leowuming/rag/resolve/main/frontend/src/utils/session.js
455 Bytes
| import { API_BASE } from "./constants"; | |
| import { baseHeaders } from "./request"; | |
| // Checks current localstorage and validates the session based on that. | |
| export default async function validateSessionTokenForUser() { | |
| const isValidSession = await fetch(`${API_BASE}/system/check-token`, { | |
| method: "GET", | |
| cache: "default", | |
| headers: baseHeaders(), | |
| }) | |
| .then((res) => res.status === 200) | |
| .catch(() => false); | |
| return isValidSession; | |
| } | |