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> <FormItem>
<FormLabel>Published Port</FormLabel> <FormLabel>Published Port</FormLabel>
<FormControl> <FormControl>
<NumberInput <NumberInput placeholder="1-65535" {...field} />
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));
}
}}
/>
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
<FormField <FormField
control={form.control} control={form.control}
name="targetPort" name="targetPort"
@@ -151,11 +140,7 @@ export const UpdatePort = ({ portId }: Props) => {
<FormItem> <FormItem>
<FormLabel>Target Port</FormLabel> <FormLabel>Target Port</FormLabel>
<FormControl> <FormControl>
<Input <Input placeholder="1-65535" {...field} />
placeholder="1-65535"
{...field}
value={field.value?.toString() || ""}
/>
</FormControl> </FormControl>
<FormMessage /> <FormMessage />