[Vuejs]-Vuex Store does not update

0👍

Mutations should be immutable to make data reactive

 mutations: {
    ADD_OFFICE: (state, offices) => {
      state.all = state.all.concat(offices)
    },
    DELETE_OFFICE: (state, id) => {
      state.all = state.all.filter(office => office.id != id)
    },
    UPDATE_OFFICE: (state, data) => {
      const officeIndex = state.all.findIndex(office => office.id === data.id)
      const newObj = Object.assign(state.all[officeIndex], data)
      state.all = [
        ...state.all.slice(0, officeIndex),
        newObj,
        ...state.all.slice(officeIndex + 1)
      ]
    }
  }, 

Leave a comment