mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
more error controls
This commit is contained in:
@@ -98,14 +98,14 @@ class EMSESPDevicesForm extends Component<EMSESPDevicesFormProps, EMSESPDevicesF
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
this.props.enqueueSnackbar("Write command sent", { variant: "success" });
|
||||
return;
|
||||
}
|
||||
if (response.status === 204) {
|
||||
this.props.enqueueSnackbar("Write command sent to device", { variant: "success" });
|
||||
} else if (response.status === 204) {
|
||||
this.props.enqueueSnackbar("Write command failed", { variant: "error" });
|
||||
return;
|
||||
} else if (response.status === 403) {
|
||||
this.props.enqueueSnackbar("Write access denied", { variant: "error" });
|
||||
} else {
|
||||
throw Error("Unexpected response code: " + response.status);
|
||||
}
|
||||
throw Error("Unexpected response code: " + response.status);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.props.enqueueSnackbar(
|
||||
|
||||
Reference in New Issue
Block a user