Files
opencloud/accounts/ui/helpers/auth.js
A.Unger 30b2756137 Add 'accounts/' from commit 'e55b8ae2f440e20e657fdc21827b935f64bd8458'
git-subtree-dir: accounts
git-subtree-mainline: fd66380082
git-subtree-split: e55b8ae2f4
2020-09-22 14:49:55 +02:00

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
})
}