From 05d7431330df82d28ccdb085aeee8b65cef2856a Mon Sep 17 00:00:00 2001 From: Manuel Brandstetter Date: Wed, 24 Jan 2024 14:39:19 +0100 Subject: [PATCH] UserMenu fetch path change --- src/components/UserMenu/UserMenu.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/UserMenu/UserMenu.tsx b/src/components/UserMenu/UserMenu.tsx index 5d3d398..87b0b85 100644 --- a/src/components/UserMenu/UserMenu.tsx +++ b/src/components/UserMenu/UserMenu.tsx @@ -10,13 +10,11 @@ type UserMenuProps = { }; const UserMenu = ({germanLabel, englishLabel, loginLabel, logoutLabel}: UserMenuProps) => { - const serverUrl = import.meta.env.PUBLIC_SCRUMLR_SERVER_URL; - const [isActive, setIsActive] = useState(false); const [isAuthenticated, setIsAuthenticated] = useState(false); useEffect(() => { - fetch(`${serverUrl}/user`, { + fetch(`api/user`, { method: "GET", credentials: "include", }).then((response) => { @@ -35,7 +33,7 @@ const UserMenu = ({germanLabel, englishLabel, loginLabel, logoutLabel}: UserMenu }, []); const handleLogout = () => { - fetch(`${serverUrl}/login`, { + fetch(`api/login`, { method: "DELETE", credentials: "include", }).then(() => {