only executes push once, why push two identical data to the array.
I am puzzled.
(this.state.updateTripInfoObj.people.data).push(obj); //
this.state.travellerInfo.after.temporary.people.data.push(obj);
commit("setTripInfoObj", {
type: "people",
res: this.state.updateTripInfoObj.people.data,
});
commit("setTravellerInfo", this.state.travellerInfo);
setTripInfoObj can only do assignment
setTripInfoObj(state, payload) {
if (payload.type === "people") {
state.updateTripInfoObj.people.data = payload.res;
} else {
const { address, people, stroke, take } = payload;
state.updateTripInfoObj = {
people: people || [],
stroke: stroke || {},
address: address || [],
take: take || {},
};
}
},