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';
|
||||
|
||||
function logout() {
|
||||
async function logout() {
|
||||
const mx = initMatrix.matrixClient;
|
||||
mx.stopClient();
|
||||
mx.logout().then(() => {
|
||||
try {
|
||||
await mx.logout();
|
||||
} catch {
|
||||
// ignore if failed to logout
|
||||
}
|
||||
mx.clearStores();
|
||||
window.localStorage.clear();
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
export default logout;
|
||||
|
|
Loading…
Reference in a new issue