From f71817b0a2a32ec5154c260220d28daaa7b7d373 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Tue, 13 Sep 2022 16:48:04 +0200 Subject: [PATCH] fix logout (#577) Co-authored-by: Timo K --- src/ClientContext.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ClientContext.tsx b/src/ClientContext.tsx index 8bd04128..24b067aa 100644 --- a/src/ClientContext.tsx +++ b/src/ClientContext.tsx @@ -252,10 +252,19 @@ export const ClientProvider: FC = ({ children }) => { [client] ); - const logout = useCallback(() => { + const logout = useCallback(async () => { + await client.logout(undefined, true); clearSession(); + setState({ + client: undefined, + loading: false, + isAuthenticated: false, + isPasswordlessUser: true, + userName: "", + error: undefined, + }); history.push("/"); - }, [history]); + }, [history, client]); useEffect(() => { // To protect against multiple sessions writing to the same storage