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

@@ -3,10 +3,8 @@ import PropTypes from 'prop-types';
import { Field, reduxForm } from 'redux-form';
import { Trans, withTranslation } from 'react-i18next';
import flow from 'lodash/flow';
import {
renderInputField, ipv4, mac, required,
} from '../../../../helpers/form';
import { renderInputField } from '../../../../helpers/form';
import { validateIpv4, validateMac, validateRequiredValue } from '../../../../helpers/validators';
import { FORM_NAME } from '../../../../helpers/constants';
const Form = (props) => {
@@ -31,7 +29,7 @@ const Form = (props) => {
type="text"
className="form-control"
placeholder={t('form_enter_mac')}
validate={[required, mac]}
validate={[validateRequiredValue, validateMac]}
/>
</div>
<div className="form__group">
@@ -42,7 +40,7 @@ const Form = (props) => {
type="text"
className="form-control"
placeholder={t('form_enter_ip')}
validate={[required, ipv4]}
validate={[validateRequiredValue, validateIpv4]}
/>
</div>
<div className="form__group">