From aba8b2be3a4c39100b7c740e71b0f9ed19048853 Mon Sep 17 00:00:00 2001 From: EgleH Date: Thu, 30 Mar 2023 13:44:19 +0200 Subject: [PATCH] logout with one click (#223) Co-authored-by: eglehelms --- src/router/auth.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/router/auth.tsx b/src/router/auth.tsx index a06afa1..917b687 100644 --- a/src/router/auth.tsx +++ b/src/router/auth.tsx @@ -136,6 +136,7 @@ export const useProvideAuth = (): AuthStateContext => { }; const signout = () => { + window.location.href = ROUTE_LOGIN; return new Promise((resolve, reject) => { postLogout() .then((response) => { @@ -143,7 +144,6 @@ export const useProvideAuth = (): AuthStateContext => { localStorage.clear(); sessionStorage.clear(); sessionStorage.setItem(SESS_FLASH_MSG, MSG_LOGGED_OUT); - window.location.href = ROUTE_LOGIN; resolve(response.json); } }) @@ -151,7 +151,6 @@ export const useProvideAuth = (): AuthStateContext => { localStorage.clear(); sessionStorage.clear(); sessionStorage.setItem(SESS_FLASH_MSG, MSG_LOGGED_OUT); - window.location.href = ROUTE_LOGIN; if (error) { reject(error); }