From fcb8af574ce79649a9c155cc9bb96cc5ae3b09ff Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Fri, 25 Jul 2025 11:46:28 +0200 Subject: [PATCH] all bugs removed --- frontend_admin/src/App.tsx | 11 +++-------- frontend_admin/src/components/Header.tsx | 8 +++++--- frontend_admin/src/components/LoginCard.tsx | 6 ++++-- frontend_admin/src/utils/context.ts | 2 +- frontend_admin/src/utils/context.tsx | 2 +- frontend_admin/src/utils/useUsers.ts | 6 ++---- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/frontend_admin/src/App.tsx b/frontend_admin/src/App.tsx index 8f93142..3a41560 100644 --- a/frontend_admin/src/App.tsx +++ b/frontend_admin/src/App.tsx @@ -13,14 +13,11 @@ function App() { loadTheme(); }, []); - const [isAuthenticated, setIsAuthenticated] = useState(!!Cookies.get("token")); + const [isAuthenticated, setIsAuthenticated] = useState( + !!Cookies.get("token") + ); const [showLogin, setShowLogin] = useState(false); - const handleLogout = () => { - Cookies.remove("token"); - setIsAuthenticated(false); - }; - return ( @@ -44,6 +41,4 @@ function App() { ); } - - export default App; diff --git a/frontend_admin/src/components/Header.tsx b/frontend_admin/src/components/Header.tsx index 3b4e96d..4c94146 100644 --- a/frontend_admin/src/components/Header.tsx +++ b/frontend_admin/src/components/Header.tsx @@ -1,15 +1,17 @@ import React, { useContext } from "react"; import Cookies from "js-cookie"; import { AuthContext } from "../utils/context"; +import { myToast } from "../utils/frontendService"; const Header: React.FC = () => { const { isAuthenticated, setIsAuthenticated } = useContext(AuthContext); - const username = Cookies.get("username"); + const firstName = Cookies.get("firstName"); const handleLogout = () => { Cookies.remove("token"); - Cookies.remove("username"); + Cookies.remove("firstName"); setIsAuthenticated(false); + myToast("Logged out successfully!", "info"); }; return ( @@ -21,7 +23,7 @@ const Header: React.FC = () => { {isAuthenticated && ( <> - Hello, {username || "User"} + Hello, {firstName || "User"}