Fix insert/update logic of the measurements store.
This commit is contained in:
parent
4cb5b8d814
commit
35a116abbb
@ -54,7 +54,7 @@ export class MeasurementStoreModule extends VuexModule {
|
|||||||
const newMeasurements = existing.slice();
|
const newMeasurements = existing.slice();
|
||||||
|
|
||||||
const index = findIndex(existing, { id: measurement.id });
|
const index = findIndex(existing, { id: measurement.id });
|
||||||
if (index > 0) { newMeasurements.push(measurement); }
|
if (index < 0) { newMeasurements.push(measurement); }
|
||||||
else { newMeasurements[index] = measurement; }
|
else { newMeasurements[index] = measurement; }
|
||||||
this.measurements = assign({}, this.measurements, { [measure.id]: newMeasurements });
|
this.measurements = assign({}, this.measurements, { [measure.id]: newMeasurements });
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user