From 94f35892dc125f0fb86172c5ac2bedb5b6f03dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Fri, 24 May 2024 09:08:06 +0800 Subject: [PATCH] =?UTF-8?q?401=E8=B7=B3=E8=BD=AC=E7=AD=89bug=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppConfig.js | 5 +++++ src/modules/tpm/TPMIndexHOC.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index cf7fe8b6a..6a1986c8f 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -66,6 +66,11 @@ export function initAxiosInterceptors(props) { return } const config = response.config; + + if (response.data.status === 401) { + window.location.href = "/login" + } + if (response.data.status === -1) { if (window.location.pathname.startsWith('/tasks/')) { props.showSnackbar(response.data.message || '服务器异常,请联系管理员。') diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 227deb177..5ed8ba55c 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -355,7 +355,7 @@ export function TPMIndexHOC(WrappedComponent) { hideNavPath = (path) => { const hideUserPath = ['/statistics', '/projects', '/notice', '/organizes', ''] - const hidePath = ['/nopage', '/403', '/500', '/organize/new', '/settings/profile'] + const hidePath = ['/nopage', '/403', '/500', '/organize/new', '/settings'] let hide = false const {current_user} = this.state; hideUserPath.forEach(e => { @@ -364,7 +364,7 @@ export function TPMIndexHOC(WrappedComponent) { } }) hidePath.forEach(e => { - if (path === e) { + if (path.includes(e)) { hide = true } })