From 36cea32ee59d277871087d7804eae314872ccbfc Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 16 Oct 2021 20:31:43 +0100 Subject: [PATCH] :alien: Add getter to return specific item --- src/store.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/store.js b/src/store.js index 306c80ef..2b2ce518 100644 --- a/src/store.js +++ b/src/store.js @@ -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) {