summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2020-12-30 10:15:16 +0900
committersyuilo <syuilotan@yahoo.co.jp>2020-12-30 10:15:16 +0900
commit3055e6d8c7c533018ca10de55c8cc803499eba48 (patch)
tree8136db90af1590a5668187cbe4cae023267a1118 /src/client
parentTweak note collapse threshold (diff)
downloadsharkey-3055e6d8c7c533018ca10de55c8cc803499eba48.tar.gz
sharkey-3055e6d8c7c533018ca10de55c8cc803499eba48.tar.bz2
sharkey-3055e6d8c7c533018ca10de55c8cc803499eba48.zip
localeとthemeのキャッシュクリア実装
Diffstat (limited to 'src/client')
-rw-r--r--src/client/init.ts6
-rw-r--r--src/client/pages/settings/index.vue8
2 files changed, 9 insertions, 5 deletions
diff --git a/src/client/init.ts b/src/client/init.ts
index 9683075785..7c3df68c34 100644
--- a/src/client/init.ts
+++ b/src/client/init.ts
@@ -91,10 +91,6 @@ if (_DEV_) {
// タッチデバイスでCSSの:hoverを機能させる
document.addEventListener('touchend', () => {}, { passive: true });
-if (localStorage.theme == null) {
- applyTheme(require('@/themes/l-light.json5'));
-}
-
//#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
// TODO: いつの日にか消したい
const vh = window.innerHeight * 0.01;
@@ -204,7 +200,7 @@ watch(defaultStore.reactiveState.darkMode, (darkMode) => {
const themes = builtinThemes.concat(ColdDeviceStorage.get('themes'));
applyTheme(themes.find(x => x.id === (darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'))));
});
-});
+}, { immediate: localStorage.theme == null });
//#region Sync dark mode
if (ColdDeviceStorage.get('syncDeviceDarkMode')) {
diff --git a/src/client/pages/settings/index.vue b/src/client/pages/settings/index.vue
index 05756716db..aa9fe27164 100644
--- a/src/client/pages/settings/index.vue
+++ b/src/client/pages/settings/index.vue
@@ -28,6 +28,9 @@
<FormLink :active="page === 'other'" replace to="/settings/other"><template #icon><Fa :icon="faEllipsisH"/></template>{{ $ts.other }}</FormLink>
</FormGroup>
<FormGroup>
+ <FormButton @click="clear">{{ $ts.clearCache }}</FormButton>
+ </FormGroup>
+ <FormGroup>
<FormButton @click="logout" danger>{{ $ts.logout }}</FormButton>
</FormGroup>
</FormBase>
@@ -126,6 +129,11 @@ export default defineComponent({
logout: () => {
signout();
},
+ clear: () => {
+ localStorage.removeItem('locale');
+ localStorage.removeItem('theme');
+ location.reload();
+ },
faPalette, faPlug, faUser, faListUl, faLock, faLaugh, faCommentSlash, faMusic, faBell, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes, faEnvelope,
};
},