Planning/frontend/src/components/UnloggedRoute.jsx
Louis Mazin 6a18a3caff clean
2026-10-02 17:10:37 +02:00

14 lines
422 B
JavaScript

import React from 'react';
import { Navigate } from 'react-router-dom';
import { useAuth } from '../context/useAuth';
import { Skeleton } from '@/components/ui/skeleton';
const UnloggedRoute = ({ children }) => {
const { user, loading } = useAuth();
if (loading) return <Skeleton className="h-16 w-full" />;
if (user) return <Navigate to="/planning" replace />;
return children;
};
export default UnloggedRoute;