feat : add front-end using shad cn
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import {Navigate} from "react-router-dom";
|
||||
import {useAuth} from "@/context/AuthContext";
|
||||
|
||||
export default function ProtectedRoute({children}: any) {
|
||||
const {token} = useAuth();
|
||||
|
||||
if (!token) {
|
||||
return <Navigate to="/" />;
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
Reference in New Issue
Block a user