Aioxs拦截器配置
axios.interceptors.request.use( config => { if(store.state.token){ config.headers.Authorization = `token ${store.state.token}`; } return config; }, err =>{ return Promise.reject(err); }); axios.interceptors.response.use( response => { return response; }, error =>{ if(error.response){ switch (error.response.status){ case 401: store.commit(types:LOGOUT); router.replace({ path:'login', query:{redirect:router.currentRoute.fullPath} }) } } return Promise.reject(error.response.data) });