mirror of
https://github.com/vernu/textbee.git
synced 2026-02-20 07:34:00 -05:00
17 lines
400 B
TypeScript
17 lines
400 B
TypeScript
import axios from 'axios'
|
|
import { LOCAL_STORAGE_KEY } from '../shared/constants'
|
|
|
|
const httpClient = axios.create({
|
|
baseURL: process.env.NEXT_PUBLIC_API_BASE_URL,
|
|
})
|
|
|
|
httpClient.interceptors.request.use((config) => {
|
|
const token = localStorage.getItem(LOCAL_STORAGE_KEY.TOKEN)
|
|
if (token) {
|
|
config.headers.Authorization = `Bearer ${token}`
|
|
}
|
|
return config
|
|
})
|
|
|
|
export default httpClient
|