Add frontend/src/api/index.js

This commit is contained in:
2026-06-09 23:35:39 +00:00
parent 715b036eb4
commit 643f90a805
+18
View File
@@ -0,0 +1,18 @@
import axios from 'axios'
const api = axios.create({
baseURL: '/api/v1',
headers: {
'Content-Type': 'application/json'
}
})
api.interceptors.request.use((config) => {
const token = localStorage.getItem('token')
if (token) {
config.headers.Authorization = `Bearer ${token}`
}
return config
})
export default api