import { Navigate, useLocation } from "react-router-dom"; import { useAuth } from "@/hooks/useAuth"; import { Loader2 } from "lucide-react"; export default function RequireAuth({ children }: { children: React.ReactNode }) { const { user, loading } = useAuth(); const location = useLocation(); if (loading) { return (
); } if (!user) return ; return <>{children}; }