🚧 Started working on itnitial state for widgets

This commit is contained in:
Alicia Sykes 2021-11-13 20:30:55 +00:00
parent 1a58d85ccc
commit cd3a304744
2 changed files with 17 additions and 3 deletions

View File

@ -51,12 +51,15 @@ const store = new Vuex.Store({
appConfig(state) {
return state.config.appConfig || {};
},
theme(state) {
return state.config.appConfig.theme;
},
sections(state) {
return filterUserSections(state.config.sections || []);
},
widgets(state) {
return state.config.widgets || [];
},
theme(state) {
return state.config.appConfig.theme;
},
webSearch(state, getters) {
return getters.appConfig.webSearch || {};
},

View File

@ -78,12 +78,23 @@ export default class ConfigAccumulator {
return sections;
}
/* Widgets */
widgets() {
const localWidgets = localStorage[localStorageKeys.CONF_WIDGETS];
if (localWidgets) {
const json = JSON.parse(localWidgets);
if (json.length >= 1) return json;
}
return this.conf.widgets || [];
}
/* Complete config */
config() {
return {
appConfig: this.appConfig(),
pageInfo: this.pageInfo(),
sections: this.sections(),
widgets: this.widgets(),
};
}
}