From c246b47c7b16f9ca3e27a2cbe720843022c50182 Mon Sep 17 00:00:00 2001 From: lingting Date: Wed, 9 Nov 2022 14:30:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9C=AA=E7=99=BB=E5=BD=95=E8=BF=87?= =?UTF-8?q?=E6=97=B6=E8=BF=9B=E5=85=A5=E9=A6=96=E9=A1=B5=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=99=BB=E5=BD=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/NotifyUtils.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils/NotifyUtils.tsx b/src/utils/NotifyUtils.tsx index 8f1d043..2ecac02 100644 --- a/src/utils/NotifyUtils.tsx +++ b/src/utils/NotifyUtils.tsx @@ -13,6 +13,8 @@ const logoutHandler = () => { cleanCache(); const { pathname } = history.location; history.replace(`${login_uri}?redirect=${pathname}`); + Token.clean(); + User.clean(); logoutModal = undefined; Modal.destroyAll(); }; @@ -53,8 +55,12 @@ const Notify = { return; } - Token.clean(); - User.clean(); + // 如果没有缓存过token - 未登录过. + if (!Token.get()) { + // 直接跳转到登录页 + logoutHandler(); + return; + } if (!logoutModal) { Modal.destroyAll();