ADD: added basic backend function plus a mockup for a cli interface
This commit is contained in:
10
frontend/studia/src/components/ProtectedRoute.tsx
Normal file
10
frontend/studia/src/components/ProtectedRoute.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Navigate } from "react-router-dom";
|
||||
import { useAuth } from "../components/AuthContext";
|
||||
import type { JSX } from 'react';
|
||||
|
||||
const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
|
||||
const { token } = useAuth() as { token?: string | null };
|
||||
return token ? children : <Navigate to="/" />;
|
||||
};
|
||||
|
||||
export default ProtectedRoute;
|
||||
Reference in New Issue
Block a user