Extract validation functions in the separate file
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user