-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
I have a question what is the best way to set the Header in
auth.login() {}?
current solution:
import Vue from 'vue';
....
login(context, creds, redirect) {
context.$http.post(LOGIN_URL, creds).then((data) => {
localStorage.setItem('id_token', data.data.id_token)
Vue.http.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('id_token');
this.user.authenticated = true
if (redirect) {
router.go(redirect)
}
}).catch(({data}) => {
context.error = data
})
},
i solve in a other way i switch to VUEX thank for the tutorial
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels