import { type ReactNode } from 'react' import { Navigate } from 'react-router-dom' import { useAuthStore } from '../../store/authStore' interface Props { children: ReactNode role: 'student' | 'instructor' } export default function ProtectedRoute({ children, role }: Props) { const user = useAuthStore((s) => s.user) if (!user) return if (user.role !== role) return return <>{children} }