I have data stored in an array within the state and I need to update a specific object. How can I change the value of the object with id 1 to true using Vuex actions?
state.js
const array=[]
mutations.js
storeArray(state, data) {
state.array = data;
}
actions.js
async modifyValue({ state, dispatch, commit }, id) {
const item = await state.array[id].value;
await commit('storeArray', { value: true });
},
The array's current structure is
[{
id: "1",
value: 'false'
}, {
id: "2",
value: 'true'
}]