Merge branch 'fix/jwt-restore'
This commit is contained in:
commit
7e846daa8d
@ -5,10 +5,12 @@ export function setToken(token) {
|
|||||||
Api.defaults.headers.common['Authorization'] = 'Bearer ' + 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() {
|
export function getToken() {
|
||||||
const token = localStorage.getItem('token')
|
const token = localStorage.getItem('token')
|
||||||
Api.defaults.headers.common['Authorization'] = 'Bearer ' + token;
|
if (token) {
|
||||||
|
Api.defaults.headers.common['Authorization'] = 'Bearer ' + token;
|
||||||
|
}
|
||||||
return token
|
return token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user