weixin_52219567 3 дней назад
Родитель
Сommit
27ee74f80b
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      src/utils/request.ts

+ 6 - 2
src/utils/request.ts

@@ -134,8 +134,12 @@ service.interceptors.response.use(
           const devPort = window.location.port || import.meta.env.VITE_APP_PORT;
           const devPort = window.location.port || import.meta.env.VITE_APP_PORT;
           url = `${url}:${devPort}/index`;
           url = `${url}:${devPort}/index`;
         }
         }
-        window.location.href = url;
-        isRelogin.show = false;
+        useUserStore()
+          .logout()
+          .then(() => {
+            window.location.href = url;
+            isRelogin.show = false;
+          });
         // ElMessageBox.confirm('登录状态已过期,请重新登录', '登录提示', {
         // ElMessageBox.confirm('登录状态已过期,请重新登录', '登录提示', {
         //   confirmButtonText: '重新登录',
         //   confirmButtonText: '重新登录',
         //   type: 'warning'
         //   type: 'warning'