reload values after write and update

This commit is contained in:
MichaelDvP
2021-07-22 12:54:02 +02:00
parent 2fda59d7db
commit fc1cb00523
6 changed files with 29 additions and 4 deletions

View File

@@ -192,6 +192,7 @@ class EMSESPDataForm extends Component<
this.props.enqueueSnackbar('Write command sent to device', {
variant: 'success'
});
this.handleRowClick(selectedDevice);
} else if (response.status === 204) {
this.props.enqueueSnackbar('Write command failed', {
variant: 'error'
@@ -315,7 +316,7 @@ class EMSESPDataForm extends Component<
<TableRow
hover
key={device.id}
onClick={() => this.handleRowClick(device)}
onClick={() => this.handleRowClick(device.id)}
>
<TableCell>
<CustomTooltip
@@ -522,10 +523,10 @@ class EMSESPDataForm extends Component<
};
handleRowClick = (device: any) => {
this.setState({ selectedDevice: device.id, deviceData: undefined });
this.setState({ selectedDevice: device, deviceData: undefined });
redirectingAuthorizedFetch(DEVICE_DATA_ENDPOINT, {
method: 'POST',
body: JSON.stringify({ id: device.id }),
body: JSON.stringify({ id: device }),
headers: {
'Content-Type': 'application/json'
}

View File

@@ -66,6 +66,7 @@ class SensorForm extends React.Component<SensorFormProps> {
]}
label="Custom Offset (°C)"
name="offset"
type="number"
value={sensor.offset}
fullWidth
variant="outlined"