From 8fd34d1bb73d53df33787a4a8c4e0e7a8aa679fc Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 8 Feb 2024 03:38:57 +0800 Subject: [PATCH] :bug: Bug fixes --- pkg/view/src/layouts/RootLayout.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/view/src/layouts/RootLayout.tsx b/pkg/view/src/layouts/RootLayout.tsx index 96d5593..544d082 100644 --- a/pkg/view/src/layouts/RootLayout.tsx +++ b/pkg/view/src/layouts/RootLayout.tsx @@ -17,16 +17,16 @@ export default function RootLayout(props: any) { createEffect(() => { if (ready()) { - keepGate(location.pathname + location.search); + keepGate(location.pathname + location.search, searchParams["embedded"] != null); } }, [ready, userinfo]); - function keepGate(path: string, e?: BeforeLeaveEventArgs) { + function keepGate(path: string, embedded: boolean, e?: BeforeLeaveEventArgs) { const blacklist = ["/creator"]; if (!userinfo?.isLoggedIn && blacklist.includes(path)) { if (!e?.defaultPrevented) e?.preventDefault(); - if (location.query["embedded"]) { + if (embedded) { navigate(`/auth?redirect_uri=${path}&embedded=${location.query["embedded"]}`); } else { navigate(`/auth?redirect_uri=${path}`);