Files
opencloud/extensions/accounts/ui/helpers/auth.js
Christian Richter 2089ac5f7b refactor accounts
Signed-off-by: Christian Richter <crichter@owncloud.com>
2022-04-13 17:04:35 +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
})
}