Fix logout not working when server offline
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user