Extract validation functions in the separate file

This commit is contained in:
ArtemBaskal
2020-07-03 19:10:05 +03:00
parent c12309a1b2
commit 0c4905fa2b
13 changed files with 275 additions and 207 deletions

View File

@@ -10,9 +10,8 @@ import AddressList from './AddressList';
import { getInterfaceIp } from '../../helpers/helpers';
import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants';
import {
renderInputField, required, validInstallPort, toNumber,
} from '../../helpers/form';
import { renderInputField, toNumber } from '../../helpers/form';
import { validateRequiredValue, validateInstallPort } from '../../helpers/validators';
const STATIC_STATUS = {
ENABLED: 'yes',
@@ -212,7 +211,7 @@ class Settings extends Component {
type="number"
className="form-control"
placeholder="80"
validate={[validInstallPort, required]}
validate={[validateInstallPort, validateRequiredValue]}
normalize={toNumber}
onChange={handleChange}
/>
@@ -282,7 +281,7 @@ class Settings extends Component {
type="number"
className="form-control"
placeholder="80"
validate={[validInstallPort, required]}
validate={[validateInstallPort, validateRequiredValue]}
normalize={toNumber}
onChange={handleChange}
/>