🐛 Fix styles issue
This commit is contained in:
		| @@ -12,24 +12,28 @@ export default function RootLayout(props: any) { | |||||||
|   const navigate = useNavigate(); |   const navigate = useNavigate(); | ||||||
|   const userinfo = useUserinfo(); |   const userinfo = useUserinfo(); | ||||||
|  |  | ||||||
|   const location = useLocation(); |  | ||||||
|   const [searchParams] = useSearchParams(); |   const [searchParams] = useSearchParams(); | ||||||
|  |   const location = useLocation(); | ||||||
|  |  | ||||||
|   createEffect(() => { |   createEffect(() => { | ||||||
|     if (ready()) { |     if (ready()) { | ||||||
|       keepGate(location.pathname + location.search); |       keepGate(location.pathname + location.search, searchParams["embedded"] != null); | ||||||
|     } |     } | ||||||
|   }, [ready, userinfo, location]); |   }, [ready, userinfo, location]); | ||||||
|  |  | ||||||
|   function keepGate(path: string, e?: BeforeLeaveEventArgs) { |   function keepGate(path: string, embedded: boolean, e?: BeforeLeaveEventArgs) { | ||||||
|     const pathname = path.split("?")[0]; |     const pathname = path.split("?")[0]; | ||||||
|     const whitelist = ["/auth/login", "/auth/register", "/users/me/confirm"]; |     const whitelist = ["/auth/login", "/auth/register", "/users/me/confirm"]; | ||||||
|  |  | ||||||
|     if (!userinfo?.isLoggedIn && !whitelist.includes(pathname)) { |     if (!userinfo?.isLoggedIn && !whitelist.includes(pathname)) { | ||||||
|       if (!e?.defaultPrevented) e?.preventDefault(); |       if (!e?.defaultPrevented) e?.preventDefault(); | ||||||
|  |       if (embedded) { | ||||||
|  |         navigate(`/auth/login?redirect_uri=${encodeURIComponent(path)}&embedded=yes`); | ||||||
|  |       } else { | ||||||
|         navigate(`/auth/login?redirect_uri=${encodeURIComponent(path)}`); |         navigate(`/auth/login?redirect_uri=${encodeURIComponent(path)}`); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   const mainContentStyles = createMemo(() => { |   const mainContentStyles = createMemo(() => { | ||||||
|     if (searchParams["embedded"]) { |     if (searchParams["embedded"]) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user