From 7c3410831bee211ca362842796a3eff703807aa6 Mon Sep 17 00:00:00 2001 From: coward Date: Tue, 18 Jun 2024 15:43:58 +0800 Subject: [PATCH] =?UTF-8?q?:art:401=E8=B7=B3=E8=BD=AC=E5=9B=9E=E7=99=BB?= =?UTF-8?q?=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/http/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/http/index.ts b/src/utils/http/index.ts index ab0f1d6..a7cf5a1 100644 --- a/src/utils/http/index.ts +++ b/src/utils/http/index.ts @@ -163,6 +163,14 @@ class PureHttp { resolve(response); }) .catch(error => { + if (error.response.status === 401) { + router.replace({ + path: "/login", + query: { + redirect: router.currentRoute.value.fullPath + } + }); + } if (error.response === null || error.response === undefined) { message(error.message, { type: "error" }); } else {