import { Navigate, Outlet } from "react-router-dom";
import { useAuth } from "../context/auth_context";

interface ProtectedRouteProps {
    allowedRoles?: string[];
}

export const ProtectedRoute = ({allowedRoles}: ProtectedRouteProps) => {
    const {user} = useAuth();
    if(!user){
        return <Navigate to="/login" replace={true}/>;
    }

    return <Outlet/>;
}