refactor: remove innecessary conversion

This commit is contained in:
Mauricio Siu
2024-10-02 13:02:20 -06:00
parent dfd6764320
commit ecfca9419a

View File

@@ -125,25 +125,14 @@ export const UpdatePort = ({ portId }: Props) => {
<FormItem>
<FormLabel>Published Port</FormLabel>
<FormControl>
<NumberInput
placeholder="1-65535"
{...field}
value={field.value?.toString() || ""}
onChange={(e) => {
const value = e.target.value;
if (value === "") {
field.onChange(0);
} else {
field.onChange(Number.parseInt(value, 10));
}
}}
/>
<NumberInput placeholder="1-65535" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="targetPort"
@@ -151,11 +140,7 @@ export const UpdatePort = ({ portId }: Props) => {
<FormItem>
<FormLabel>Target Port</FormLabel>
<FormControl>
<Input
placeholder="1-65535"
{...field}
value={field.value?.toString() || ""}
/>
<Input placeholder="1-65535" {...field} />
</FormControl>
<FormMessage />