I have a Vuex array (this.buildings). I can't mutate it directly before turning it into a payload for an api, so I tried to clone it with slice():
const buildingsPayload = this.buildings.slice()
buildingsPayload.forEach((building, index) => {
building.index = index
})
However I'm still getting the Do not mutate vuex store state outside mutation handlers. error.
What's the correct way of doing this?