2021-07-28 18:45:52 +05:30
|
|
|
import initMatrix from '../initMatrix';
|
|
|
|
|
|
2022-08-11 13:41:07 +05:30
|
|
|
async function logout() {
|
2021-07-28 18:45:52 +05:30
|
|
|
const mx = initMatrix.matrixClient;
|
2021-10-27 17:08:26 +05:30
|
|
|
mx.stopClient();
|
2022-08-11 13:41:07 +05:30
|
|
|
try {
|
|
|
|
|
await mx.logout();
|
|
|
|
|
} catch {
|
|
|
|
|
// ignore if failed to logout
|
|
|
|
|
}
|
|
|
|
|
mx.clearStores();
|
|
|
|
|
window.localStorage.clear();
|
|
|
|
|
window.location.reload();
|
2021-07-28 18:45:52 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default logout;
|