WIP updates

This commit is contained in:
Sacha Weatherstone
2022-11-27 22:50:46 +10:00
parent a9561fe622
commit e457cef3da
79 changed files with 2100 additions and 1284 deletions
@@ -18,16 +18,16 @@ export const MQTT = (): JSX.Element => {
handleSubmit,
formState: { errors, isDirty },
reset,
control,
control
} = useForm<MQTTValidation>({
defaultValues: moduleConfig.mqtt,
resolver: classValidatorResolver(MQTTValidation),
resolver: classValidatorResolver(MQTTValidation)
});
const moduleEnabled = useWatch({
control,
name: "enabled",
defaultValue: false,
defaultValue: false
});
useEffect(() => {
@@ -37,22 +37,22 @@ export const MQTT = (): JSX.Element => {
const onSubmit = handleSubmit((data) => {
if (connection) {
void toast.promise(
connection.setModuleConfig(
{
connection.setModuleConfig({
moduleConfig: {
payloadVariant: {
oneofKind: "mqtt",
mqtt: data,
},
mqtt: data
}
},
async () => {
callback: async () => {
reset({ ...data });
await Promise.resolve();
}
),
}),
{
loading: "Saving...",
success: "Saved MQTT Config, Restarting Node",
error: "No response received",
error: "No response received"
}
);
}