fix logout (#577)

Co-authored-by: Timo K <timok@element.io>
This commit is contained in:
Timo 2022-09-13 16:48:04 +02:00 committed by GitHub
parent 73d09bc99c
commit f71817b0a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -252,10 +252,19 @@ export const ClientProvider: FC<Props> = ({ 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