mo 2 years ago
parent
commit
fb290ec019
1 changed files with 7 additions and 6 deletions
  1. 7 6
      src/utils/request.js

+ 7 - 6
src/utils/request.js

@@ -38,16 +38,17 @@ service.interceptors.response.use(
       })
 
       // 401:未登录;
-      if (res.code === 401) {
-        MessageBox.confirm('你已被登出,可以取消继续留在该页面,或者重新登录', '确定登出', {
+      if (res.code === 401 || res.code === 403) {
+        MessageBox.confirm('登录过期请重新登录', '确定登出', {
           confirmButtonText: '重新登录',
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          store.dispatch('FedLogOut').then(() => {
-            // location.reload()// 为了重新实例化vue-router对象 避免bug
-            location.href = window.location.hostname;
-          })
+          // store.dispatch('FedLogOut').then(() => {
+          //   // location.reload()// 为了重新实例化vue-router对象 避免bug
+          //   location.href = window.location.hostname;
+          // })
+          location.href = window.location.hostname;
         })
       }
       return Promise.reject('error')