Browse Source

Merge branch 'master' into master

good luck 4 years ago
parent
commit
89bfc69757
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/utils/request.js

+ 8 - 1
src/utils/request.js

@@ -9,6 +9,7 @@ import {
   requestTimeout,
   successCode,
   tokenName,
+  loginInterception,
 } from "@/config/settings";
 import store from "@/store";
 import qs from "qs";
@@ -43,7 +44,13 @@ const handleCode = (code, msg) => {
   switch (code) {
     case invalidCode:
       Vue.prototype.$baseMessage(msg || `后端接口${code}异常`, "error");
-      store.dispatch("user/resetAll").catch(() => {});
+
+      store.dispatch("user/resetAccessToken").catch(() => {});
+
+      if (loginInterception) {
+        location.reload();
+      }
+
       break;
     case noRoleCode:
       router.push({ path: "/401" }).catch(() => {});