delete state

This commit is contained in:
britea 2020-04-25 18:27:09 +02:00
parent 2d9bdf63fb
commit b6a27195fe

View file

@ -32,6 +32,10 @@ class Device extends React.Component {
.catch((err) => console.error(`Smart plug reset error`, err)); .catch((err) => console.error(`Smart plug reset error`, err));
} }
deleteState() {
this.props.deleteState(this.props.id, this.props.type);
}
renderDeviceComponent() { renderDeviceComponent() {
console.log(JSON.stringify(this.props.stateOrDevice)); console.log(JSON.stringify(this.props.stateOrDevice));
switch ( switch (
@ -171,6 +175,15 @@ class Device extends React.Component {
? this.props.stateOrDevice.name ? this.props.stateOrDevice.name
: ""} : ""}
</Header> </Header>
<Button
color="red"
icon
onClick={this.deleteState}
labelPosition="left"
>
<Icon name="undo" />
Delete
</Button>
</Grid.Column> </Grid.Column>
)} )}
</Grid> </Grid>