From 45fbd9d1e4f63c6e43512d9d532d491367cc55ee Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Thu, 21 Dec 2023 08:43:04 +0800
Subject: [PATCH] 修复弹窗bug
---
src/util/request.js | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/util/request.js b/src/util/request.js
index 2fb29a4..965afa7 100644
--- a/src/util/request.js
+++ b/src/util/request.js
@@ -36,25 +36,23 @@
(response) => {
// 对响应数据做点什么
if (response.data.code && response.data.code === 401) {
- message.error('用户不存在');
- loginOut()
- .then(() => {
- Session.clear();
- window.location.href = '/';
- });
- // useLoginApi()
- // .signOut()
- // .then(() => {
- // Session.clear();
- // window.location.href = '/';
- // });
+ // 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);
},
@@ -63,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