element admin token过期怎么返回登录页面
response => {const res = response.data
let that = this;
if (res.code !=0 && !(res instanceof Blob)) {
Message({
message: res.msg || 'Error',
type: 'error',
duration: 5 * 1000
})
if (res.code === -10) {
console.log('token123', res);
that.$store.dispatch('user/logout')
that.$router.push({
path: '/login',
})
}
return Promise.reject(new Error(res.message || 'Error'))
} else {
return res
}
},
回答
你这里写判断是过期吗?你这是封装的请求吧;
router.push({path:"/login"})
axios拦截器里面统一封装对过期请求的处理
以上是 element admin token过期怎么返回登录页面 的全部内容, 来源链接: utcz.com/a/43608.html