From 1692098d5d8254eb9241527f23673762586e72e9 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Thu, 11 Aug 2022 13:41:07 +0530 Subject: [PATCH] Fix logout not working when server offline --- src/client/action/logout.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/client/action/logout.js b/src/client/action/logout.js index 3c7b848..c4047bb 100644 --- a/src/client/action/logout.js +++ b/src/client/action/logout.js @@ -1,13 +1,16 @@ import initMatrix from '../initMatrix'; -function logout() { +async function logout() { const mx = initMatrix.matrixClient; mx.stopClient(); - mx.logout().then(() => { - mx.clearStores(); - window.localStorage.clear(); - window.location.reload(); - }); + try { + await mx.logout(); + } catch { + // ignore if failed to logout + } + mx.clearStores(); + window.localStorage.clear(); + window.location.reload(); } export default logout;