Browse Source

请求拦截错误处理

master
qqkj 5 years ago
parent
commit
87f091492d
  1. 5
      src/utils/request.js

5
src/utils/request.js

@ -49,7 +49,7 @@ service.interceptors.response.use(
response => {
if(response.data && response.data.tips && response.data.tips.msg == 'Full authentication is required to access this resource'){
Message.error('会话过期,请重新登陆')
response.data.tips.msg="会话过期,请重新登陆";
//response.data.tips.msg="会话过期,请重新登陆";
store.dispatch('FedLogOut').then(() => {
router.replace({path: '/login'})
})
@ -63,9 +63,10 @@ service.interceptors.response.use(
case 401:
// 返回 401 清除token信息并跳转到登录页面
Message.error('会话过期,请重新登陆')
store.dispatch('FedLogOut').then(() => {
store.dispatch('FedLogOut').then(() => {
router.replace({path: '/login'})
})
return;
}
}

Loading…
Cancel
Save