From d1bb49c208e4bb270eea0d1ce20012e2ade92d8b Mon Sep 17 00:00:00 2001 From: coward Date: Fri, 7 Jun 2024 17:09:21 +0800 Subject: [PATCH] =?UTF-8?q?:art:=E4=BC=98=E5=8C=96=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E9=A1=B5=E9=9D=A2=E9=80=80=E5=87=BA=E4=BA=86?= =?UTF-8?q?=EF=BC=8C=E5=85=B6=E4=BB=96=E9=83=BD=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-src/src/utils/http/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web-src/src/utils/http/index.ts b/web-src/src/utils/http/index.ts index ab0f1d6..221bc50 100644 --- a/web-src/src/utils/http/index.ts +++ b/web-src/src/utils/http/index.ts @@ -135,6 +135,14 @@ class PureHttp { $error.isCancelRequest = Axios.isCancel($error); // 关闭进度条动画 NProgress.done(); + if ($error.response.status === 401) { + router.replace({ + path: "/login", + query: { + redirect: router.currentRoute.value.fullPath + } + }); + } // 所有的响应异常 区分来源为取消请求/非取消请求 return Promise.reject($error); }