git-subtree-dir: accounts git-subtree-mainline:fd66380082git-subtree-split:e55b8ae2f4
13 lines
292 B
JavaScript
13 lines
292 B
JavaScript
import axios from 'axios'
|
|
|
|
export function injectAuthToken (token) {
|
|
axios.interceptors.request.use(config => {
|
|
if (typeof config.headers.Authorization === 'undefined') {
|
|
if (token) {
|
|
config.headers.Authorization = `Bearer ${token}`
|
|
}
|
|
}
|
|
return config
|
|
})
|
|
}
|