Skip to content

Commit f71817b

Browse files
authored
fix logout (#577)
Co-authored-by: Timo K <[email protected]>
1 parent 73d09bc commit f71817b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/ClientContext.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,19 @@ export const ClientProvider: FC<Props> = ({ children }) => {
252252
[client]
253253
);
254254

255-
const logout = useCallback(() => {
255+
const logout = useCallback(async () => {
256+
await client.logout(undefined, true);
256257
clearSession();
258+
setState({
259+
client: undefined,
260+
loading: false,
261+
isAuthenticated: false,
262+
isPasswordlessUser: true,
263+
userName: "",
264+
error: undefined,
265+
});
257266
history.push("/");
258-
}, [history]);
267+
}, [history, client]);
259268

260269
useEffect(() => {
261270
// To protect against multiple sessions writing to the same storage

0 commit comments

Comments
 (0)