From 895740a3cb9e0611b214e5c82abb338dbc99829c Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Sat, 11 Sep 2021 02:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=95=B0=E6=8D=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/index.tsx | 7 ++++++- src/pages/setting/security.tsx | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 852892ad..6faee78f 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -47,13 +47,18 @@ export default function (props: any) { }); }; + useEffect(() => { + if (!user) { + getUser(); + } + }, [props.location.pathname]); + useEffect(() => { const isAuth = localStorage.getItem(config.authKey); if (!isAuth) { history.push('/login'); } vhCheck(); - getUser(); // patch custome layout title as react node [object, object] document.title = '控制面板'; diff --git a/src/pages/setting/security.tsx b/src/pages/setting/security.tsx index e689bbcd..2fa6217f 100644 --- a/src/pages/setting/security.tsx +++ b/src/pages/setting/security.tsx @@ -124,7 +124,12 @@ const SecuritySettings = ({ user, userChange }: any) => { 使用手机应用扫描二维码,或者输入秘钥 {twoFactorInfo?.secret}