try to fix
This commit is contained in:
parent
2a1cc0292c
commit
c878702331
3 changed files with 19 additions and 9 deletions
|
@ -72,10 +72,18 @@ class Light extends Component {
|
|||
.saveDevice({ ...this.props.stateOrDevice, on })
|
||||
.catch((err) => console.error("regular light update error", err));
|
||||
} else {
|
||||
this.props.updateState(
|
||||
{ id: this.props.sceneState.id, on: on },
|
||||
this.props.sceneState.kind
|
||||
);
|
||||
this.props
|
||||
.updateState(
|
||||
{
|
||||
id: this.props.sceneState.id,
|
||||
on: on,
|
||||
sceneId: this.props.sceneState.sceneId,
|
||||
},
|
||||
this.props.sceneState.kind
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ export const RemoteService = {
|
|||
|
||||
return Endpoint.put(url, {}, data)
|
||||
.then((res) => {
|
||||
dispatch(actions.stateUpdate(res.data));
|
||||
dispatch(actions.stateSave(res.data));
|
||||
return res.data;
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -164,9 +164,6 @@ function reducer(previousState, action) {
|
|||
|
||||
newState = update(newState, change);
|
||||
|
||||
break;
|
||||
case "STATE_UPDATE":
|
||||
//update the state
|
||||
break;
|
||||
case "DEVICES_UPDATE":
|
||||
change = null;
|
||||
|
@ -295,7 +292,12 @@ function reducer(previousState, action) {
|
|||
sceneStates: { [action.sceneState.id]: { $set: action.sceneState } },
|
||||
};
|
||||
|
||||
if (previousState.scenes[action.sceneState.sceneId]) {
|
||||
if (
|
||||
!previousState.scenes[action.sceneState.sceneId].sceneStates[
|
||||
action.sceneState.id
|
||||
]
|
||||
) {
|
||||
console.log("Ciao");
|
||||
change.scenes = {
|
||||
[action.sceneState.sceneId]: {
|
||||
sceneStates: {
|
||||
|
|
Loading…
Reference in a new issue