1d22adc42e
Backend (Express + MariaDB) y frontend (React + Vite, identidad Fluent/Windows) con el nucleo funcional: seguridad, organizacion, proyectos, actividades, subtareas, dependencias, dashboard, calendario, gantt, comentarios, adjuntos, notificaciones in-app y catalogos. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
10 lines
287 B
React
10 lines
287 B
React
import { Navigate } from 'react-router-dom';
|
|
import { useAuth } from '../context/auth-context.jsx';
|
|
|
|
export function ProtectedRoute({ children }) {
|
|
const { user, ready } = useAuth();
|
|
if (!ready) return null;
|
|
if (!user) return <Navigate to="/login" replace />;
|
|
return children;
|
|
}
|