import { Navigate, useLocation } from 'react-router-dom'; import type { ReactNode } from 'react'; import { useAuthStore } from '@/features/auth/authStore'; export function ProtectedRoute({ children }: { children: ReactNode }) { const { user, status } = useAuthStore(); const location = useLocation(); if (status !== 'ready') { return (
Loading...
); } if (!user) { return ; } return <>{children}; }