You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
409 B
16 lines
409 B
import axios from 'axios'
|
|
import { LOCAL_STORAGE_KEY } from '../shared/constants'
|
|
|
|
const axiosInstance = axios.create({
|
|
baseURL: process.env.NEXT_PUBLIC_API_BASE_URL,
|
|
})
|
|
|
|
axiosInstance.interceptors.request.use((config) => {
|
|
const token = localStorage.getItem(LOCAL_STORAGE_KEY.TOKEN)
|
|
if (token) {
|
|
config.headers.Authorization = `Bearer ${token}`
|
|
}
|
|
return config
|
|
})
|
|
|
|
export default axiosInstance
|