Fix logout not working when server offline

This commit is contained in:
Ajay Bura 2022-08-11 13:41:07 +05:30
parent fbab53af22
commit 1692098d5d

View file

@ -1,13 +1,16 @@
import initMatrix from '../initMatrix'; import initMatrix from '../initMatrix';
function logout() { async function logout() {
const mx = initMatrix.matrixClient; const mx = initMatrix.matrixClient;
mx.stopClient(); mx.stopClient();
mx.logout().then(() => { try {
mx.clearStores(); await mx.logout();
window.localStorage.clear(); } catch {
window.location.reload(); // ignore if failed to logout
}); }
mx.clearStores();
window.localStorage.clear();
window.location.reload();
} }
export default logout; export default logout;