Prechádzať zdrojové kódy

优化token校验失败登出

li.shaoyi 3 rokov pred
rodič
commit
95c225151c
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      src/services/bus/token.ts

+ 2 - 3
src/services/bus/token.ts

@@ -1,6 +1,5 @@
-import Router from '@/router';
 import APP from '@/services';
-import { getLoginData } from '@/services/bus/login';
+import { getLoginData, logout } from '@/services/bus/login';
 import { tokenCheck } from '@/services/socket/login/index';
 import timerUtil from '@/utils/timer/timerUtil';
 
@@ -24,7 +23,7 @@ export function getToken(): string {
  */
 export function handleTokenCheck() {
     return tokenCheck().catch((err) => {
-        Router.push({ path: '/login' }); // 回到登录页面
+        logout();
         console.error(`token校验失败:${err}`);
         return Promise.reject(`token校验失败:${err}`);
     });