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}