forked from github/cinny
Add Clear cache and reload button (#793)
Inspired by: https://github.com/matrix-org/matrix-react-sdk/blob/3c5c2bef6dbac51ce6e1864056523815ca4c38d9/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:
@@ -239,6 +239,7 @@ function AboutSection() {
|
|||||||
<div className="settings-about__btns">
|
<div className="settings-about__btns">
|
||||||
<Button onClick={() => window.open('https://github.com/ajbura/cinny')}>Source code</Button>
|
<Button onClick={() => window.open('https://github.com/ajbura/cinny')}>Source code</Button>
|
||||||
<Button onClick={() => window.open('https://cinny.in/#sponsor')}>Support</Button>
|
<Button onClick={() => window.open('https://cinny.in/#sponsor')}>Support</Button>
|
||||||
|
<Button onClick={() => settings.clearCacheAndReload()} variant="danger">Clear cache & reload</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -147,6 +147,14 @@ class Settings extends EventEmitter {
|
|||||||
return settings.isNotificationSounds;
|
return settings.isNotificationSounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearCacheAndReload() {
|
||||||
|
const mx = initMatrix.matrixClient;
|
||||||
|
mx.stopClient()
|
||||||
|
mx.store.deleteAllData().then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setter(action) {
|
setter(action) {
|
||||||
const actions = {
|
const actions = {
|
||||||
[cons.actions.settings.TOGGLE_SYSTEM_THEME]: () => {
|
[cons.actions.settings.TOGGLE_SYSTEM_THEME]: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user