added updateState to store

This commit is contained in:
Jacob Salvi 2020-04-25 15:43:27 +02:00
parent 1484026afd
commit b56b9a8260
2 changed files with 4 additions and 4 deletions

View file

@ -99,7 +99,7 @@ class Light extends Component {
.saveDevice({ ...this.props.device, intensity }) .saveDevice({ ...this.props.device, intensity })
.catch((err) => console.error("regular light update error", err)); .catch((err) => console.error("regular light update error", err));
}else{ }else{
this.props.updateState({ ...this.props.device, on },this.props.type); this.props.updateState({ ...this.props.device, intensity },this.props.type);
} }
}; };

View file

@ -68,7 +68,7 @@ class Thermostats extends Component {
.saveDevice({ ...this.props.device, turnOn }) .saveDevice({ ...this.props.device, turnOn })
.catch((err) => console.error("thermostat update error", err)); .catch((err) => console.error("thermostat update error", err));
}else{ }else{
this.props.updateState({ ...this.props.device, on },this.props.type); this.props.updateState({ ...this.props.device, turnOn },this.props.type);
} }
} }
@ -90,7 +90,7 @@ class Thermostats extends Component {
.saveDevice({ ...this.props.device, targetTemperature }) .saveDevice({ ...this.props.device, targetTemperature })
.catch((err) => console.error("thermostat update error", err)); .catch((err) => console.error("thermostat update error", err));
}else{ }else{
this.props.updateState({ ...this.props.device, on },this.props.type); this.props.updateState({ ...this.props.device, targetTemperature },this.props.type);
} }
} }
@ -118,7 +118,7 @@ class Thermostats extends Component {
.saveDevice({ ...this.props.device, internalSensorTemperature }) .saveDevice({ ...this.props.device, internalSensorTemperature })
.catch((err) => console.error("thermostat update error", err)); .catch((err) => console.error("thermostat update error", err));
}else{ }else{
this.props.updateState({ ...this.props.device, on },this.props.type); this.props.updateState({ ...this.props.device, internalSensorTemperature },this.props.type);
} }
} }