Fixed Auth header being set when not signed in
This commit is contained in:
parent
735da45324
commit
3c77aeaa0a
@ -5,10 +5,12 @@ export function setToken(token) {
|
||||
Api.defaults.headers.common['Authorization'] = 'Bearer ' + token;
|
||||
}
|
||||
|
||||
// should only be run at initialization
|
||||
// should only be run at initialization, use VueX store after
|
||||
export function getToken() {
|
||||
const token = localStorage.getItem('token')
|
||||
Api.defaults.headers.common['Authorization'] = 'Bearer ' + token;
|
||||
if (token) {
|
||||
Api.defaults.headers.common['Authorization'] = 'Bearer ' + token;
|
||||
}
|
||||
return token
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user