From 98c2a37ab666f60d224e0a4b759076e43ee3268f Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 23 Sep 2022 00:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 62c401d0..5a7ce75b 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -41,6 +41,7 @@ export default function () { const ws = useRef(null); const [socketMessage, setSocketMessage] = useState(); const [collapsed, setCollapsed] = useState(false); + const [initLoading, setInitLoading] = useState(true); const { enable: enableDarkMode, disable: disableDarkMode, @@ -64,7 +65,6 @@ export default function () { setSystemInfo(data); if (!data.isInitialized) { history.push('/initialization'); - setLoading(false); } else { getUser(); } @@ -72,7 +72,8 @@ export default function () { }) .catch((error) => { console.log(error); - }); + }) + .finally(() => setInitLoading(false)); }; const getUser = (needLoading = true) => { @@ -192,6 +193,10 @@ export default function () { }; }, []); + if (initLoading) { + return ; + } + if (['/login', '/initialization', '/error'].includes(location.pathname)) { document.title = `${ (config.documentTitleMap as any)[location.pathname]