14 lines
422 B
JavaScript
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;
|