From 8f569e3ea0e98c8cec6d4babd18971a95fe5561e Mon Sep 17 00:00:00 2001 From: rizky Date: Mon, 22 Jul 2024 07:09:23 -0700 Subject: [PATCH] fix layout --- preset/menu/Layout.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/preset/menu/Layout.tsx b/preset/menu/Layout.tsx index 3a45033..ba3f0e0 100755 --- a/preset/menu/Layout.tsx +++ b/preset/menu/Layout.tsx @@ -2,9 +2,10 @@ import { getPathname } from "lib/utils/pathname"; import { FC, ReactNode, useEffect, useLayoutEffect, useState } from "react"; import { loadSession } from "../login/utils/load"; import { useLocal } from "lib/utils/use-local"; +import { FieldLoading } from "lib/exports"; const w = window as any; -const fn = function () { +const initResponsive = function () { const mode = localStorage.getItem("prasi-editor-mode"); if (isEditor) { setTimeout(() => { @@ -62,11 +63,14 @@ export const Layout: FC = (props) => { } }, []); - fn(); + initResponsive(); const path = getPathname(); const no_layout = props.exception; - if (!w.user) loadSession(props.login_url || "/auth/login"); + if (!w.user) { + local.loading = true; + loadSession(props.login_url || "/auth/login"); + } if (!isEditor && Array.isArray(no_layout)) { if (no_layout.length) { @@ -77,7 +81,12 @@ export const Layout: FC = (props) => { } if (path === props.login_url) return props.blank_layout; - if (!w.user && !isEditor) return props.blank_layout; + if (!w.user && !isEditor) + return ( +
+ +
+ ); return (