Add clear cache btn in loading screen
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import initMatrix from '../initMatrix';
|
||||
|
||||
async function logout() {
|
||||
const mx = initMatrix.matrixClient;
|
||||
mx.stopClient();
|
||||
try {
|
||||
await mx.logout();
|
||||
} catch {
|
||||
// ignore if failed to logout
|
||||
}
|
||||
mx.clearStores();
|
||||
window.localStorage.clear();
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
export default logout;
|
||||
@@ -98,13 +98,32 @@ class InitMatrix extends EventEmitter {
|
||||
}
|
||||
|
||||
listenEvents() {
|
||||
this.matrixClient.on('Session.logged_out', () => {
|
||||
this.matrixClient.on('Session.logged_out', async () => {
|
||||
this.matrixClient.stopClient();
|
||||
this.matrixClient.clearStores();
|
||||
await this.matrixClient.clearStores();
|
||||
window.localStorage.clear();
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
async logout() {
|
||||
this.matrixClient.stopClient();
|
||||
try {
|
||||
await this.matrixClient.logout();
|
||||
} catch {
|
||||
// ignore if failed to logout
|
||||
}
|
||||
await this.matrixClient.clearStores();
|
||||
window.localStorage.clear();
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
clearCacheAndReload() {
|
||||
this.matrixClient.stopClient();
|
||||
this.matrixClient.store.deleteAllData().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const initMatrix = new InitMatrix();
|
||||
|
||||
@@ -147,14 +147,6 @@ class Settings extends EventEmitter {
|
||||
return settings.isNotificationSounds;
|
||||
}
|
||||
|
||||
clearCacheAndReload() {
|
||||
const mx = initMatrix.matrixClient;
|
||||
mx.stopClient()
|
||||
mx.store.deleteAllData().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
setter(action) {
|
||||
const actions = {
|
||||
[cons.actions.settings.TOGGLE_SYSTEM_THEME]: () => {
|
||||
|
||||
Reference in New Issue
Block a user