Kaynağa Gözat

鉴权失效返回地址调整

zhangjie 3 yıl önce
ebeveyn
işleme
4947c0b5f7
1 değiştirilmiş dosya ile 6 ekleme ve 0 silme
  1. 6 0
      src/plugins/axios.js

+ 6 - 0
src/plugins/axios.js

@@ -149,6 +149,12 @@ const errorDataCallback = response => {
   const unauthCodes = [401, 403];
 
   if (unauthCodes.includes(response.status)) {
+    const returnUrl = Vue.ls.get("user", { returnUrl: "" }).returnUrl;
+    if (returnUrl) {
+      this.$message.error("身份验证失效!");
+      window.location.href = returnUrl;
+      return;
+    }
     if (unauthMsgBoxIsShow) return error;
     unauthMsgBoxIsShow = true;
     message = "身份验证失效,请重新登录";