Skip to content
Snippets Groups Projects
Commit 5e9e7abf authored by Erkan Karabulut's avatar Erkan Karabulut
Browse files

fix device observation deletion method

parent 6e727a22
No related branches found
No related tags found
No related merge requests found
......@@ -28,11 +28,15 @@ const observation = (state = initialState, action) => {
});
break;
case 'REMOVE_DEVICE_OBSERVATIONS':
state.observationList.forEach(function (observation) {
if (observation.sensorIds.includes(action.deviceId)){
let counter = 0;
while (counter < state.observationList.length) {
let observation = state.observationList[counter];
if (observation.sensorIds.includes(action.deviceId)) {
state.observationList.splice(state.observationList.indexOf(observation), 1);
} else {
counter++;
}
})
}
}
return {observationList: state.observationList};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment