I'm encountering an issue with my Vuex.Store:
My goal is to retrieve an object (getter.getRecipe) by using two state entries as search criteria (state.array & state.selected) through a getter. Then, I want to store the outcome in my state (state.recipe) so that I can update it within components (e.g., modifying one key of the recipe object based on user interaction). However, I'm unsure of how to save the result of getters in my state ("this.getters.getRecipe" isn't functioning...). Any suggestions would be greatly appreciated. Thank you.
//store.js (vuex store)
export const store = new Vuex.Store({
state: {
array: [recipe1, recipe2],
selected: 0,
recipe: this.getters.getRecipe()
},
getters: {
getRecipe: (state) => {
return state.array[state.selected]
}
}
})