🐛 Fix config not saving from JSON editor

This commit is contained in:
Alicia Sykes 2024-04-13 14:05:49 +01:00
parent 91e4cfe14d
commit 4ea77a1015
4 changed files with 20 additions and 11 deletions

View File

@ -143,7 +143,11 @@ export default {
this.$modal.hide(modalNames.CONF_EDITOR); this.$modal.hide(modalNames.CONF_EDITOR);
}, },
writeToDisk() { 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() { saveLocally() {
const msg = this.$t('interactive-editor.menu.save-locally-warning'); const msg = this.$t('interactive-editor.menu.save-locally-warning');

View File

@ -52,9 +52,11 @@ const ThemingMixin = {
watch: { watch: {
/* When theme in VueX store changes, then update theme */ /* When theme in VueX store changes, then update theme */
themeFromStore(newTheme) { themeFromStore(newTheme) {
if (newTheme) {
this.resetToDefault(); this.resetToDefault();
this.selectedTheme = newTheme; this.selectedTheme = newTheme;
this.updateTheme(newTheme); this.updateTheme(newTheme);
}
}, },
}, },
methods: { methods: {

View File

@ -3,7 +3,7 @@ import sha256 from 'crypto-js/sha256';
import ConfigAccumulator from '@/utils/ConfigAccumalator'; import ConfigAccumulator from '@/utils/ConfigAccumalator';
import { cookieKeys, localStorageKeys, serviceEndpoints } from '@/utils/defaults'; import { cookieKeys, localStorageKeys, serviceEndpoints } from '@/utils/defaults';
import { InfoHandler, ErrorHandler, InfoKeys } from '@/utils/ErrorHandler'; import { InfoHandler, ErrorHandler, InfoKeys } from '@/utils/ErrorHandler';
import { logout, getUserState } from '@/utils/Auth'; import { logout } from '@/utils/Auth';
const getAppConfig = () => { const getAppConfig = () => {
const Accumulator = new ConfigAccumulator(); const Accumulator = new ConfigAccumulator();
@ -39,8 +39,7 @@ class HeaderAuth {
const sha = strAndUpper(sha256(strAndUpper(user.user) + strAndUpper(user.hash))); const sha = strAndUpper(sha256(strAndUpper(user.user) + strAndUpper(user.hash)));
document.cookie = `${cookieKeys.AUTH_TOKEN}=${sha};`; document.cookie = `${cookieKeys.AUTH_TOKEN}=${sha};`;
localStorage.setItem(localStorageKeys.USERNAME, user.user); localStorage.setItem(localStorageKeys.USERNAME, user.user);
InfoHandler(`Succesfully signed in as ${response.data.user}`, InfoKeys.AUTH); InfoHandler(`Successfully signed in as ${response.data.user}`, InfoKeys.AUTH);
console.log('I think we\'re good', getUserState());
resolve(response.data.user); resolve(response.data.user);
} }
}); });

View File

@ -119,12 +119,16 @@ export default {
}, },
watch: { watch: {
layoutOrientation(layout) { layoutOrientation(layout) {
if (layout) {
localStorage.setItem(localStorageKeys.LAYOUT_ORIENTATION, layout); localStorage.setItem(localStorageKeys.LAYOUT_ORIENTATION, layout);
this.layout = layout; this.layout = layout;
}
}, },
iconSize(size) { iconSize(size) {
if (size) {
localStorage.setItem(localStorageKeys.ICON_SIZE, size); localStorage.setItem(localStorageKeys.ICON_SIZE, size);
this.itemSizeBound = size; this.itemSizeBound = size;
}
}, },
}, },
methods: { methods: {