logout with one click (#223)

Co-authored-by: eglehelms <e.helms@cognigy.com>
This commit is contained in:
EgleH
2023-03-30 13:44:19 +02:00
committed by GitHub
parent f4d7880ab7
commit aba8b2be3a
+1 -2
View File
@@ -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);
}