Loading web/src/router/protected_route.tsx 0 → 100644 +15 −0 Original line number Diff line number Diff line 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/>; } No newline at end of file Loading
web/src/router/protected_route.tsx 0 → 100644 +15 −0 Original line number Diff line number Diff line 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/>; } No newline at end of file