Added improved login and logout route for the frontend. The frontend page now doesn't have to reload.

This commit is contained in:
2025-08-19 14:21:30 +02:00
parent 06f84cddc4
commit 8fbcd069b5
7 changed files with 68 additions and 56 deletions

View File

@@ -1,7 +1,10 @@
import React from "react";
import Cookies from "js-cookie";
const Header: React.FC = () => {
type HeaderProps = {
onLogout: () => void;
};
const Header: React.FC<HeaderProps> = ({ onLogout }) => {
return (
<header className="mb-6 md:mb-10">
<h1 className="text-3xl md:text-4xl font-extrabold text-blue-800 tracking-tight drop-shadow-sm">
@@ -11,12 +14,8 @@ const Header: React.FC = () => {
Schnell und unkompliziert Equipment reservieren
</p>
<button
onClick={() => {
Cookies.remove("token");
localStorage.removeItem("allItems");
window.location.reload();
}}
type="button"
onClick={onLogout}
className="text-blue-500 hover:underline"
>
Logout