This commit is contained in:
Hunter Thornsberry
2024-08-06 00:58:26 -04:00
parent cd0fcbbf90
commit 32acd23362
3 changed files with 21 additions and 30 deletions
+8 -5
View File
@@ -15,8 +15,12 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
const { config, connection, addChannel } = useDevice();
const { toast } = useToast();
const [pass, setPass] = useState<string>(fromByteArray(channel?.settings?.psk ?? new Uint8Array(0)));
const [bitCount, setBits] = useState<number>(channel?.settings?.psk.length ?? 16);
const [pass, setPass] = useState<string>(
fromByteArray(channel?.settings?.psk ?? new Uint8Array(0)),
);
const [bitCount, setBits] = useState<number>(
channel?.settings?.psk.length ?? 16,
);
const onSubmit = (data: ChannelValidation) => {
const channel = new Protobuf.Channel.Channel({
@@ -41,7 +45,6 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
});
};
const clickEventCb = (e) => {
setPass(
btoa(
@@ -51,7 +54,7 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
}),
),
);
}
};
return (
<DynamicForm<ChannelValidation>
@@ -101,7 +104,7 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
properties: {
value: pass,
onClick: clickEventCb,
changeEvent: (e: string) => setBits(parseInt(e)),
changeEvent: (e: string) => setBits(Number.parseInt(e)),
},
},
{