mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-02 22:43:23 +00:00
* chore: upgrade frontend application dependencies * chore: upgrade frontend infrastructure dependencies * fix: align lockfiles with CI npm * fix: preserve ky error semantics * fix: sanitize timeout error message
29 lines
649 B
TypeScript
29 lines
649 B
TypeScript
import { Navigate } from "react-router";
|
|
import { useAuthContext } from "@/providers/auth-context";
|
|
import { Box, CircularProgress } from "@mui/material";
|
|
|
|
interface GuestRouteProps {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export function GuestRoute({ children }: GuestRouteProps) {
|
|
const { isAuthenticated, isLoading } = useAuthContext();
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<Box
|
|
className="flex min-h-screen items-center justify-center"
|
|
role="status"
|
|
aria-label="Loading"
|
|
>
|
|
<CircularProgress />
|
|
</Box>
|
|
);
|
|
}
|
|
|
|
if (isAuthenticated) {
|
|
return <Navigate to="/" replace />;
|
|
}
|
|
|
|
return children;
|
|
}
|