From 573ffe1661000af4523122ce182c838cdd50e1c6 Mon Sep 17 00:00:00 2001 From: britea Date: Thu, 26 Mar 2020 11:11:44 +0100 Subject: [PATCH] fix devide default name --- .../components/dashboard/devices/NewDevice.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/smart-hut/src/components/dashboard/devices/NewDevice.js b/smart-hut/src/components/dashboard/devices/NewDevice.js index 219bf1c..5616ae0 100644 --- a/smart-hut/src/components/dashboard/devices/NewDevice.js +++ b/smart-hut/src/components/dashboard/devices/NewDevice.js @@ -36,7 +36,7 @@ export default class NewDevice extends Component { step: 1, openModal: false, motion: false, - name: "", + deviceName: "", }; this.baseState = this.state; this.createDevice = this.createDevice.bind(this); @@ -97,23 +97,23 @@ export default class NewDevice extends Component { switch (this.state.typeOfDevice) { case "regularLight": - if (this.state.name === "") { + if (this.state.deviceName === "") { data.params["name"] = "Regular Light"; } break; case "smartPlug": - if (this.state.name === "") { + if (this.state.deviceName === "") { data.params["name"] = "Smart Plug"; } break; case "dimmableLight": - if (this.state.name === "") { + if (this.state.deviceName === "") { data.params["name"] = "Dimmable Light"; } data.params["intensity"] = 0; break; case "sensor": - if (this.state.name === "") { + if (this.state.deviceName === "") { data.params["name"] = "Sensor"; } if (!this.state.motion) { @@ -122,19 +122,19 @@ export default class NewDevice extends Component { } break; case "switch": - if (this.state.name === "") { + if (this.state.deviceName === "") { data.params["name"] = "Switch"; } data.params["lights"] = this.state.lightsAttached; break; case "buttonDimmer": - if (this.state.name === "") { + if (this.state.deviceName === "") { data.params["name"] = "Button Dimmer"; } data.params["lights"] = this.state.lightsAttached; break; case "knobDimmer": - if (this.state.name === "") { + if (this.state.deviceName === "") { data.params["name"] = "Knob Dimmer"; } data.params["lights"] = this.state.lightsAttached; @@ -142,7 +142,7 @@ export default class NewDevice extends Component { default: break; } - console.log(data); + this.props.addDevice(data); this.resetState(); }