refactor: use min() instead of test()
This commit is contained in:
parent
6fc33261f9
commit
6ab979cca3
1 changed files with 4 additions and 4 deletions
|
|
@ -42,13 +42,13 @@ const REGISTER = gql`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const PASSWORD_MIN_LENGTH = 8
|
||||||
const validationSchema = Yup.object({
|
const validationSchema = Yup.object({
|
||||||
password: Yup.string()
|
password: Yup.string()
|
||||||
.required('A password is required')
|
.required('A password is required')
|
||||||
.test(
|
.min(
|
||||||
'len',
|
PASSWORD_MIN_LENGTH,
|
||||||
'Your password must contain at least 8 characters',
|
`Your password must contain at least ${PASSWORD_MIN_LENGTH} characters`
|
||||||
val => val.length >= 8
|
|
||||||
),
|
),
|
||||||
confirmPassword: Yup.string()
|
confirmPassword: Yup.string()
|
||||||
.required('Please confirm the password')
|
.required('Please confirm the password')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue