2023-11-23 08:47:44 +07:00
|
|
|
import axios from 'axios'
|
2023-11-29 16:58:53 +07:00
|
|
|
import { getToken } from './KeyCloakService'
|
2023-11-23 08:47:44 +07:00
|
|
|
|
2023-11-29 16:58:53 +07:00
|
|
|
const instance = axios.create()
|
2023-11-23 08:47:44 +07:00
|
|
|
|
2023-11-29 16:58:53 +07:00
|
|
|
instance.interceptors.request.use(async (config) => {
|
|
|
|
|
config.headers.Authorization = `Bearer ${await getToken()}`
|
2023-11-23 08:47:44 +07:00
|
|
|
return config
|
2023-11-29 16:58:53 +07:00
|
|
|
})
|
2023-11-23 08:47:44 +07:00
|
|
|
|
2023-11-29 16:58:53 +07:00
|
|
|
export default instance
|