Files
helix-engage/src/components/layout/auth-guard.tsx
2026-03-23 16:41:58 +05:30

13 lines
290 B
TypeScript

import { Navigate, Outlet } from "react-router";
import { useAuth } from "@/providers/auth-provider";
export const AuthGuard = () => {
const { isAuthenticated } = useAuth();
if (!isAuthenticated) {
return <Navigate to="/login" replace />;
}
return <Outlet />;
};