Add Clear cache and reload button (#793)

Inspired by: 3c5c2bef6d/src/components/views/elements/ErrorBoundary.tsx (L61-L68)

Signed-off-by: morguldir <morguldir@protonmail.com>

Signed-off-by: morguldir <morguldir@protonmail.com>
This commit is contained in:
morguldir 2022-09-17 09:51:22 +02:00 committed by GitHub
parent a8f374dd43
commit 4848bef0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -239,6 +239,7 @@ function AboutSection() {
<div className="settings-about__btns">
<Button onClick={() => window.open('https://github.com/ajbura/cinny')}>Source code</Button>
<Button onClick={() => window.open('https://cinny.in/#sponsor')}>Support</Button>
<Button onClick={() => settings.clearCacheAndReload()} variant="danger">Clear cache & reload</Button>
</div>
</div>
</div>

View file

@ -147,6 +147,14 @@ 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]: () => {