Fix logout not working when server offline
This commit is contained in:
parent
fbab53af22
commit
1692098d5d
1 changed files with 9 additions and 6 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue