Changeset 3ebe47c for frontend/src/api/axios.js
- Timestamp:
- 02/09/26 21:36:40 (5 months ago)
- Branches:
- master
- Children:
- 8615885
- Parents:
- 140d098
- File:
-
- 1 edited
-
frontend/src/api/axios.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/api/axios.js
r140d098 r3ebe47c 1 1 import axios from "axios"; 2 2 3 export default axios.create({ 4 baseURL: "http://localhost:8080/api", 5 withCredentials: true, // important if using cookies 3 const api = axios.create({ 4 baseURL: import.meta.env.VITE_API_BASE_URL ?? "http://localhost:8080/api", 6 5 }); 6 7 api.interceptors.request.use((config) => { 8 const token = localStorage.getItem("authToken"); 9 if (token) { 10 config.headers = config.headers ?? {}; 11 config.headers.Authorization = `Bearer ${token}`; 12 } 13 return config; 14 }); 15 16 export default api;
Note:
See TracChangeset
for help on using the changeset viewer.
