Skip to content

Commit

Permalink
fix manualIpHostnameForm
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Feb 8, 2024
1 parent 19d8e5b commit 496b1ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
19 changes: 11 additions & 8 deletions app/src/organisms/AppSettings/ManualIpHostnameForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ export function ManualIpHostnameForm({
if (!ip) {
message = t('add_ip_error')
}
return {
...errors,
ip: {
type: 'error',
message: message,
},
}
const updatedErrors =
message != null
? {
...errors,
ip: {
type: 'error',
message: message,
},
}
: errors
return updatedErrors
}

const resolver: Resolver<FormValues> = values => {
Expand All @@ -103,7 +107,6 @@ export function ManualIpHostnameForm({
},
resolver: resolver,
})
console.log('errors', formState.errors)

const onSubmit = (data: FormValues): void => {
const trimmedIp = data.ip.trim()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { Controller } from 'react-hook-form'
import { Control, Controller } from 'react-hook-form'
import styled, { css } from 'styled-components'

import {
Expand Down Expand Up @@ -91,6 +91,7 @@ export const FormModal = (props: FormModalProps): JSX.Element => {
<Controller
key={name}
control={control}
// @ts-expect-error: ts can't tell that name is the correct value
name={name}
render={({ field, fieldState }) => (
<StyledSecurityField
Expand All @@ -110,6 +111,7 @@ export const FormModal = (props: FormModalProps): JSX.Element => {
<Controller
key={name}
control={control}
// @ts-expect-error: ts can't tell that name is the correct value
name={name}
render={({ field, fieldState }) => (
<StyledKeyFileField
Expand All @@ -128,6 +130,7 @@ export const FormModal = (props: FormModalProps): JSX.Element => {
<Controller
key={name}
control={control}
// @ts-expect-error: ts can't tell that name is the correct value
name={name}
render={({ field, fieldState }) => (
<StyledTextField
Expand Down

0 comments on commit 496b1ed

Please sign in to comment.