biome
This commit is contained in:
@@ -59,48 +59,40 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
|
||||
};
|
||||
|
||||
const validatePass = (input: string, count: number) => {
|
||||
if (count == 32) {
|
||||
if (input.length != 44) {
|
||||
if (count === 32) {
|
||||
if (input.length !== 44) {
|
||||
setValidationText("Please enter a valid 256 bit PSK.");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setValidationText(undefined);
|
||||
}
|
||||
}
|
||||
else if (count == 16)
|
||||
{
|
||||
if (input.length != 24) {
|
||||
} else if (count === 16) {
|
||||
if (input.length !== 24) {
|
||||
setValidationText("Please enter a valid 128 bit PSK.");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setValidationText(undefined);
|
||||
}
|
||||
}
|
||||
else if (count == 1)
|
||||
{
|
||||
if (input.length != 4) {
|
||||
} else if (count === 1) {
|
||||
if (input.length !== 4) {
|
||||
setValidationText("Please enter a valid 1 bit PSK");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setValidationText(undefined);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setValidationText("Unkown PSK length.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const inputChangeEvent = (e) => {
|
||||
let psk = e.currentTarget?.value;
|
||||
const psk = e.currentTarget?.value;
|
||||
setPass(psk);
|
||||
validatePass(psk, bitCount);
|
||||
};
|
||||
|
||||
const selectChangeEvent = (e: string) => {
|
||||
let count = Number.parseInt(e);
|
||||
const count = Number.parseInt(e);
|
||||
setBits(count);
|
||||
validatePass(pass, count);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<DynamicForm<ChannelValidation>
|
||||
@@ -152,7 +144,7 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
|
||||
selectChange: selectChangeEvent,
|
||||
buttonClick: clickEvent,
|
||||
properties: {
|
||||
value: pass
|
||||
value: pass,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user