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
@@ -22,10 +22,10 @@ export const Bluetooth = (): JSX.Element => {
handleSubmit,
formState: { errors, isDirty },
control,
reset,
reset
} = useForm<BluetoothValidation>({
defaultValues: config.bluetooth,
resolver: classValidatorResolver(BluetoothValidation),
resolver: classValidatorResolver(BluetoothValidation)
});
useEffect(() => {
@@ -35,22 +35,22 @@ export const Bluetooth = (): JSX.Element => {
const onSubmit = handleSubmit((data) => {
if (connection) {
void toast.promise(
connection.setConfig(
{
connection.setConfig({
config: {
payloadVariant: {
oneofKind: "bluetooth",
bluetooth: data,
},
bluetooth: data
}
},
async () => {
callback: async () => {
reset({ ...data });
await Promise.resolve();
}
),
}),
{
loading: "Saving...",
success: "Saved Bluetooth Config, Restarting Node",
error: "No response received",
error: "No response received"
}
);
}
@@ -59,7 +59,7 @@ export const Bluetooth = (): JSX.Element => {
const pairingMode = useWatch({
control,
name: "mode",
defaultValue: Protobuf.Config_BluetoothConfig_PairingMode.RANDOM_PIN,
defaultValue: Protobuf.Config_BluetoothConfig_PairingMode.RANDOM_PIN
});
return (
@@ -98,7 +98,7 @@ export const Bluetooth = (): JSX.Element => {
description="Pin to use when pairing"
type="number"
{...register("fixedPin", {
valueAsNumber: true,
valueAsNumber: true
})}
/>
</Form>