ADD: card component and login behavior

This commit is contained in:
hwinkel
2025-12-16 23:14:40 +01:00
parent 435ad8e6e6
commit f4eb2efb33
16 changed files with 361 additions and 87 deletions

View File

@@ -3,8 +3,15 @@ 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="/" />;
// const { token } = useAuth();
const token = localStorage.getItem('token');
// console.log(token);
if(token!=null)
return children;
else
console.log(token)
return <Navigate to="/" />;
// return token ? children : <Navigate to="/" />;
};
export default ProtectedRoute;