fixed edit name on devices

This commit is contained in:
britea 2020-04-21 16:18:05 +02:00
parent 77f7abed92
commit 3b67e57f1a

View file

@ -1,5 +1,5 @@
import React, { Component, useState } from "react"; import React, { Component, useState } from "react";
import { Button, Form, Icon, Header, Modal } from "semantic-ui-react"; import { Button, Form, Icon, Header, Modal, Input } from "semantic-ui-react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { RemoteService } from "../../../remote"; import { RemoteService } from "../../../remote";
@ -37,12 +37,11 @@ const SettingsForm = (props) => {
<Form> <Form>
<Form.Field> <Form.Field>
<label>Edit Name: </label> <label>Edit Name: </label>
<input <Input
autoComplete="off" autoComplete="off"
name="name" name="name"
onChange={handleInputChange} onChange={handleInputChange}
value={props.name} placeholder={props.name}
placeholder="Device name"
// {this.props.device.name} // {this.props.device.name}
/> />
</Form.Field> </Form.Field>
@ -85,7 +84,7 @@ class DeviceSettingsModal extends Component {
if (values.name.length === 0) return; if (values.name.length === 0) return;
this.props this.props
.saveDevice({ ...this.props.device, name: values.name }) .saveDevice({ ...this.props.device, name: values.name })
.then(() => this.setState({ open: false })) .then(() => this.setState({ openModal: false }))
.catch((err) => .catch((err) =>
console.error( console.error(
`settings modal for device ${this.props.id} deletion error`, `settings modal for device ${this.props.id} deletion error`,