import axios from 'axios' const baseURL = (import.meta.env.VITE_BACKEND_URL as string) || 'http://localhost:8080'; const api = axios.create({ baseURL, withCredentials: true, headers: { 'Content-Type': 'application/json', }, }); export const setAuthToken = (token?: string) => { if (token) { api.defaults.headers.common['Authorization'] = `Bearer ${token}`; } else { delete api.defaults.headers.common['Authorization']; } }; export default api;