- Fix all Ultracite lint errors on changed source files (0 remaining) - Remove project.test.ts and use-personal-organization.test.ts (to be rewritten when implementation stabilizes) - Replace .at(-1) with index access for backend tsconfig ES target compat - Rename generator functions to avoid no-shadow conflicts - Refactor nested ternaries into helper functions - Fix unused imports
30 lines
751 B
TypeScript
30 lines
751 B
TypeScript
import { useWebAuth } from "@code/auth/web";
|
|
import { Navigate, Outlet, useLocation } from "react-router";
|
|
|
|
export default function AppLayout() {
|
|
const auth = useWebAuth();
|
|
const location = useLocation();
|
|
|
|
if (auth.status === "loading") {
|
|
return (
|
|
<div className="grid min-h-svh place-items-center text-sm text-muted-foreground">
|
|
Loading…
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (auth.status === "inconsistent") {
|
|
return (
|
|
<div className="grid min-h-svh place-items-center text-sm text-muted-foreground">
|
|
Your session could not be verified
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (auth.status === "unauthenticated") {
|
|
return <Navigate replace state={{ from: location.pathname }} to="/login" />;
|
|
}
|
|
|
|
return <Outlet />;
|
|
}
|