From 167f0e41147847aed50259811a40730b1d223f20 Mon Sep 17 00:00:00 2001
From: zhouwenxuan <1175765986@qq.com>
Date: 星期四, 21 十二月 2023 08:45:38 +0800
Subject: [PATCH] app版本控制

---
 src/util/request.js |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/util/request.js b/src/util/request.js
index 34ba6b5..965afa7 100644
--- a/src/util/request.js
+++ b/src/util/request.js
@@ -35,21 +35,24 @@
 http.interceptors.response.use(
     (response) => {
         // 对响应数据做点什么
-        if (response.data.code && response.data.code === 'A0213') {
-            message.error('用户uid不存在');
-            // useLoginApi()
-            //     .signOut()
-            //     .then(() => {
-            //         Session.clear();
-            //         window.location.href = '/';
-            //     });
+        if (response.data.code && response.data.code === 401) {
+            // message.error('用户不存在')
+            setTimeout(()=>{
+                loginOut()
+                    .then(() => {
+                        Session.clear();
+                        window.location.href = '/';
+                    });
+            },2000)
         } else if (response.data.code && response.data.code === 405) {
-            message.error('token失效');
+            message.error('token失效')
+            setTimeout(()=>{
             loginOut()
                 .then(() => {
                     Session.clear();
                     window.location.href = '/';
                 });
+            },2000)
         }
         return Promise.resolve(response);
     },
@@ -58,7 +61,7 @@
         if (error.message.indexOf('timeout') != -1) {
             message.error('网络超时');
             setTimeout(() => {
-                Session.clear();
+                Session.clear()
                 window.location.href = '/';
             }, 1000);
         } else if (error.message == 'Network Error') {

--
Gitblit v1.9.2