mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-26 08:25:14 +00:00
Refactor noErrors function helper when validating forms
This commit is contained in:
parent
8d9c058ac0
commit
ff025ecfe6
@ -71,3 +71,5 @@ export const inLimit = (limit: number, base: number, baseText: string, symbol: s
|
|||||||
|
|
||||||
return `Should not exceed ${max} ${symbol} (amount to reach ${baseText})`
|
return `Should not exceed ${max} ${symbol} (amount to reach ${baseText})`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const noErrorsOn = (name: string, errors: Object) => errors[name] === undefined
|
||||||
|
@ -3,7 +3,7 @@ import * as React from 'react'
|
|||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import Field from '~/components/forms/Field'
|
import Field from '~/components/forms/Field'
|
||||||
import TextField from '~/components/forms/TextField'
|
import TextField from '~/components/forms/TextField'
|
||||||
import { required, composeValidators, uniqueAddress, mustBeEthereumAddress } from '~/components/forms/validator'
|
import { required, composeValidators, uniqueAddress, mustBeEthereumAddress, noErrorsOn } from '~/components/forms/validator'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
import Button from '~/components/layout/Button'
|
import Button from '~/components/layout/Button'
|
||||||
import Row from '~/components/layout/Row'
|
import Row from '~/components/layout/Row'
|
||||||
@ -75,8 +75,6 @@ const getAddressValidators = (addresses: string[], position: number) => {
|
|||||||
return composeValidators(required, mustBeEthereumAddress, uniqueAddress(copy))
|
return composeValidators(required, mustBeEthereumAddress, uniqueAddress(copy))
|
||||||
}
|
}
|
||||||
|
|
||||||
const noErrorsOn = (name: string, errors: Object) => errors[name] === undefined
|
|
||||||
|
|
||||||
export const ADD_OWNER_BUTTON = '+ ADD ANOTHER OWNER'
|
export const ADD_OWNER_BUTTON = '+ ADD ANOTHER OWNER'
|
||||||
|
|
||||||
export const calculateValuesAfterRemoving = (index: number, notRemovedOwners: number, values: Object) => {
|
export const calculateValuesAfterRemoving = (index: number, notRemovedOwners: number, values: Object) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user