Spaces:
Runtime error
Runtime error
Download client/src/lib/api-client.js from keys-i/frontend-app: direct link, hf CLI and curl.
- Browser
- Download file 531 Bytes
-
https://huggingface.co/spaces/keys-i/frontend-app/resolve/main/client/src/lib/api-client.js
- Command line
-
hf download hf://spaces/keys-i/frontend-app/client/src/lib/api-client.js
-
curl -L -o api-client.js https://huggingface.co/spaces/keys-i/frontend-app/resolve/main/client/src/lib/api-client.js
531 Bytes
| import axios from "axios"; | |
| import Cookies from "js-cookie"; | |
| import { HOST } from "./constants"; | |
| const apiClient = axios.create({ | |
| baseURL: HOST, | |
| }); | |
| apiClient.interceptors.request.use( | |
| (config) => { | |
| const token = Cookies.get("access-token"); | |
| if ( | |
| token && | |
| !config.url.includes("/login") && | |
| !config.url.includes("/signup") | |
| ) { | |
| config.headers.Authorization = `Bearer ${token}`; | |
| } | |
| return config; | |
| }, | |
| (error) => { | |
| return Promise.reject(error); | |
| } | |
| ); | |
| export default apiClient; | |