Adds VueX store state for modal open state

This commit is contained in:
Alicia Sykes 2021-10-10 14:27:01 +01:00
parent 004bffce18
commit 8d111a1623
2 changed files with 8 additions and 2 deletions

View File

@ -4,14 +4,16 @@ import Vuex from 'vuex';
import Keys from '@/utils/StoreMutations';
import ConfigAccumulator from '@/utils/ConfigAccumalator';
import { componentVisibility } from '@/utils/ConfigHelpers';
import filterUserSections from '@/utils/CheckSectionVisibility';
Vue.use(Vuex);
const { UPDATE_CONFIG } = Keys;
const { UPDATE_CONFIG, SET_MODAL_OPEN } = Keys;
const store = new Vuex.Store({
state: {
config: {},
modalOpen: false, // KB shortcut functionality will be disabled when modal is open
},
getters: {
config(state) {
@ -24,7 +26,7 @@ const store = new Vuex.Store({
return state.config.appConfig || {};
},
sections(state) {
return state.config.sections || [];
return filterUserSections(state.config.sections || []);
},
webSearch(state, getters) {
return getters.appConfig.webSearch || {};
@ -37,6 +39,9 @@ const store = new Vuex.Store({
[UPDATE_CONFIG](state, config) {
state.config = config;
},
[SET_MODAL_OPEN](state, modalOpen) {
state.modalOpen = modalOpen;
},
},
actions: {
initializeConfig({ commit }) {

View File

@ -1,6 +1,7 @@
// A list of mutation names
const KEY_NAMES = [
'UPDATE_CONFIG',
'SET_MODAL_OPEN',
];
// Convert array of key names into an object, and export