You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a bit unclear on what you'd like to achieve. Are you wanting to send a header on the POST request that you have in your login method? Or are you wanting to set up a global Authorization header with the user's JWT if login is successful?
Vue.http.interceptors.push((request,next)=>{consttoken=getLoginToken();if(token){request.headers['Authorization']='Bearer '+token}next((response)=>{if(response.status===401&&response.request.url!=="/session/create"){//Todo: no hardcoded routeswindow.location.pathname="/admin/login"}});});
I have a question what is the best way to set the Header in
auth.login() {}?
current solution:
import Vue from 'vue';
....
i solve in a other way i switch to VUEX thank for the tutorial
The text was updated successfully, but these errors were encountered: