Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ› Fix config not saving from JSON editor

Alicia Sykes4ea77a101573
diff --git a/src/components/Configuration/JsonEditor.vue b/src/components/Configuration/JsonEditor.vue
index 65c21556..0267d2a2 100644
--- a/src/components/Configuration/JsonEditor.vue
+++ b/src/components/Configuration/JsonEditor.vue
@@ -143,7 +143,11 @@ export default {
this.$modal.hide(modalNames.CONF_EDITOR);
},
writeToDisk() {
- this.writeConfigToDisk(this.config);
+ const newData = this.jsonData;
+ this.writeConfigToDisk(newData);
+ // this.$store.commit(StoreKeys.SET_APP_CONFIG, newData.appConfig);
+ this.$store.commit(StoreKeys.SET_PAGE_INFO, newData.pageInfo);
+ this.$store.commit(StoreKeys.SET_SECTIONS, newData.sections);
},
saveLocally() {
const msg = this.$t('interactive-editor.menu.save-locally-warning');
diff --git a/src/mixins/ThemingMixin.js b/src/mixins/ThemingMixin.js
index 6eddb131..64e21e7d 100644
--- a/src/mixins/ThemingMixin.js
+++ b/src/mixins/ThemingMixin.js
@@ -52,9 +52,11 @@ const ThemingMixin = {
watch: {
/* When theme in VueX store changes, then update theme */
themeFromStore(newTheme) {
- this.resetToDefault();
- this.selectedTheme = newTheme;
- this.updateTheme(newTheme);
+ if (newTheme) {
+ this.resetToDefault();
+ this.selectedTheme = newTheme;
+ this.updateTheme(newTheme);
+ }
},
},
methods: {
diff --git a/src/utils/HeaderAuth.js b/src/utils/HeaderAuth.js
index 69f417e6..33475de6 100644
--- a/src/utils/HeaderAuth.js
+++ b/src/utils/HeaderAuth.js
@@ -3,7 +3,7 @@ import sha256 from 'crypto-js/sha256';
import ConfigAccumulator from '@/utils/ConfigAccumalator';
import { cookieKeys, localStorageKeys, serviceEndpoints } from '@/utils/defaults';
import { InfoHandler, ErrorHandler, InfoKeys } from '@/utils/ErrorHandler';
-import { logout, getUserState } from '@/utils/Auth';
+import { logout } from '@/utils/Auth';
const getAppConfig = () => {
const Accumulator = new ConfigAccumulator();
@@ -39,8 +39,7 @@ class HeaderAuth {
const sha = strAndUpper(sha256(strAndUpper(user.user) + strAndUpper(user.hash)));
document.cookie = `${cookieKeys.AUTH_TOKEN}=${sha};`;
localStorage.setItem(localStorageKeys.USERNAME, user.user);
- InfoHandler(`Succesfully signed in as ${response.data.user}`, InfoKeys.AUTH);
- console.log('I think we\'re good', getUserState());
+ InfoHandler(`Successfully signed in as ${response.data.user}`, InfoKeys.AUTH);
resolve(response.data.user);
}
});
diff --git a/src/views/Home.vue b/src/views/Home.vue
index eba9ea99..157afc16 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -119,12 +119,16 @@ export default {
},
watch: {
layoutOrientation(layout) {
- localStorage.setItem(localStorageKeys.LAYOUT_ORIENTATION, layout);
- this.layout = layout;
+ if (layout) {
+ localStorage.setItem(localStorageKeys.LAYOUT_ORIENTATION, layout);
+ this.layout = layout;
+ }
},
iconSize(size) {
- localStorage.setItem(localStorageKeys.ICON_SIZE, size);
- this.itemSizeBound = size;
+ if (size) {
+ localStorage.setItem(localStorageKeys.ICON_SIZE, size);
+ this.itemSizeBound = size;
+ }
},
},
methods: {