full project: admin panel, backend modules, docs

This commit is contained in:
Lizandro Guarnizo
2026-06-03 22:11:01 -05:00
parent 1635723035
commit afc096d552
94 changed files with 15994 additions and 240 deletions
+19
View File
@@ -0,0 +1,19 @@
'use client';
import { useAuth } from '@/lib/auth';
import { useRouter } from 'next/navigation';
import { useEffect, type ReactNode } from 'react';
export default function AuthGuard({ children }: { children: ReactNode }) {
const { user, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !user) router.replace('/login');
}, [user, isLoading, router]);
if (isLoading) return <div className="flex h-screen items-center justify-center text-muted-foreground">Cargando...</div>;
if (!user) return null;
return <>{children}</>;
}