aki-008's picture
chore: small fix
f63667d
raw
history blame
358 Bytes
import axios from "axios";
const API = axios.create({
baseURL: "http://localhost:8000/api/v1",
});
// Attach token automatically for every request
API.interceptors.request.use((config) => {
const token = localStorage.getItem("token");
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
});
export default API;