diff --git a/ui/src/layout/Layout.tsx b/ui/src/layout/Layout.tsx index 75f6cc1..7840cb4 100644 --- a/ui/src/layout/Layout.tsx +++ b/ui/src/layout/Layout.tsx @@ -55,6 +55,7 @@ const Layout = observer(() => { const { currentUser: { loggedIn, + authenticating, user: {name, admin}, logout, tryReconnect, @@ -79,7 +80,9 @@ const Layout = observer(() => { }; const authed = (children: React.ReactNode) => ( - {children} + + {children} + ); return ( @@ -167,11 +170,16 @@ const Lazy = ({component}: {component: () => Promise<{default: React.ComponentTy ); }; -const RequireAuth: React.FC> = ({ - children, - loggedIn, -}) => { - return loggedIn ? <>{children} : ; +const RequireAuth: React.FC< + React.PropsWithChildren<{loggedIn: boolean; authenticating: boolean}> +> = ({children, authenticating, loggedIn}) => { + if (authenticating) { + return ; + } + if (!loggedIn) { + return ; + } + return <>{children}; }; export default Layout;