Merge branch '80-fix-editname-device' into 'dev'
fixed edit name on devices Closes #80 See merge request sa4-2020/the-sanmarinoes/frontend!90
This commit is contained in:
commit
df1f753785
1 changed files with 4 additions and 5 deletions
|
@ -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`,
|
||||||
|
|
Loading…
Reference in a new issue