fix: missing name error message
This commit is contained in:
parent
87293cd21b
commit
185c620835
1 changed files with 4 additions and 4 deletions
|
|
@ -29,14 +29,14 @@ const NameOfRequirement = () => {
|
||||||
const validationSchema = existingRequirements =>
|
const validationSchema = existingRequirements =>
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
requirementName: Yup.string()
|
requirementName: Yup.string()
|
||||||
.required('A requirement name is required')
|
.required('Name is required')
|
||||||
.test(
|
.test(
|
||||||
'unique-name',
|
'unique-name',
|
||||||
'A custom information requirement with that name already exists',
|
'A custom information requirement with that name already exists',
|
||||||
(value, _context) =>
|
(value, _context) =>
|
||||||
!R.any(
|
!R.includes(
|
||||||
it => R.equals(R.toLower(it), R.toLower(value)),
|
R.toLower(R.defaultTo('', value)),
|
||||||
R.map(it => it.customRequest.name, existingRequirements)
|
R.map(it => R.toLower(it.customRequest.name), existingRequirements)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue