Config saving behaviour change

This commit is contained in:
Sacha Weatherstone
2022-12-31 17:14:11 +11:00
parent f7fe27d621
commit ec25ec60ee
18 changed files with 227 additions and 103 deletions

View File

@@ -12,7 +12,7 @@ import { useDevice } from "@core/providers/useDevice.js";
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
export const Telemetry = (): JSX.Element => {
const { moduleConfig, connection } = useDevice();
const { moduleConfig, connection, setModuleConfig } = useDevice();
const {
register,
handleSubmit,
@@ -40,10 +40,14 @@ export const Telemetry = (): JSX.Element => {
}
}
})
.then(async () => {
reset({ ...data });
await Promise.resolve();
}),
.then(() =>
setModuleConfig({
payloadVariant: {
oneofKind: "telemetry",
telemetry: data
}
})
),
{
loading: "Saving...",
success: "Saved Telemetry Config, Restarting Node",