apply scene in host
This commit is contained in:
parent
c1898ffa6c
commit
d1cd93afe5
3 changed files with 13 additions and 2 deletions
|
@ -16,6 +16,13 @@ class HostsPanel extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
applyHostScene(id) {
|
||||
this.props
|
||||
.sceneApply(id, this.props.activeHost)
|
||||
.then(() => console.log("SCCUESS"))
|
||||
.catch((err) => console.error("sceneApply update error", err));
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.props.isActiveDefaultHost) {
|
||||
return (
|
||||
|
@ -48,7 +55,7 @@ class HostsPanel extends Component {
|
|||
</Card.Header>
|
||||
<Card.Content extras>
|
||||
<div className="ui two buttons">
|
||||
<Button>Apply</Button>
|
||||
<Button onClick={this.applyHostScene(scene.id)}>Apply</Button>
|
||||
</div>
|
||||
</Card.Content>
|
||||
</Card>
|
||||
|
|
|
@ -549,9 +549,12 @@ export const RemoteService = {
|
|||
};
|
||||
},
|
||||
|
||||
sceneApply: (id) => {
|
||||
sceneApply: (id, hostId = null) => {
|
||||
return (dispatch) => {
|
||||
let url = `/scene/${id}/apply`;
|
||||
if (hostId) {
|
||||
url = url + "?hostId=" + hostId;
|
||||
}
|
||||
|
||||
return Endpoint.post(url)
|
||||
.then((res) => dispatch(actions.deviceOperationUpdate(res.data)))
|
||||
|
|
|
@ -49,6 +49,7 @@ function reducer(previousState, action) {
|
|||
[scene.id]: {
|
||||
name: { $set: scene.name },
|
||||
icon: { $set: scene.icon },
|
||||
guestAccessEnabled: { $set: scene.guestAccessEnabled },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue