File size: 320 Bytes
81fc505 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | import axios from "axios";
import { STORAGE_KEYS } from "./storage";
export const api = axios.create({
baseURL: "/api"
});
api.interceptors.request.use((config) => {
const token = localStorage.getItem(STORAGE_KEYS.token);
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
});
|