👽 Add getter to return specific item

This commit is contained in:
Alicia Sykes 2021-10-16 20:31:43 +01:00
parent 685d559716
commit 36cea32ee5

View File

@ -35,6 +35,14 @@ const store = new Vuex.Store({
visibleComponents(state, getters) {
return componentVisibility(getters.appConfig);
},
getItemById: (state, getters) => (id) => {
let item;
getters.sections.forEach(sec => {
const foundItem = sec.items.find((itm) => itm.id === id);
if (foundItem) item = foundItem;
});
return item;
},
},
mutations: {
[UPDATE_CONFIG](state, config) {