Merge branch 'dev' into 'master'

Submission attempt 2

See merge request sa4-2020/the-sanmarinoes/frontend!80
This commit is contained in:
Claudio Maggioni 2020-03-26 11:29:14 +01:00
commit 0e75123429

View file

@ -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();
}