🐛 token 失效未正常清除客户端登录态问题修复

This commit is contained in:
ronger 2021-12-17 19:53:42 +08:00
parent f70e7bf2d1
commit 58b1677251

View File

@ -22,19 +22,19 @@ export default function ({app, $axios, store, redirect}) {
if (response.data.success) {
resolve(response.data);
} else {
if (response.data.code === '0') {
if (response.data.code === 0) {
Message.error(message ? message : '服务异常')
} else if (response.data.code === '401') {
} else if (response.data.code === 401) {
Cookie.remove('auth');
store.commit('setAuth', null);
window.location.reload()
} else if (response.data.code === '402') {
} else if (response.data.code === 402) {
Cookie.remove('auth');
store.commit('setAuth', null);
window.location.reload()
} else if (response.data.code === '404') {
} else if (response.data.code === 404) {
Message.error('操作失败,请稍后再试......')
} else if (response.data.code === '500') {
} else if (response.data.code === 500) {
Message.error('服务器正在开小差,请稍后再试......')
} else {
Message.error(response.data.message);