Fix validation order
This commit is contained in:
parent
d041ad621f
commit
5f3335c566
|
@ -35,7 +35,7 @@ export const createValidationStore = () => {
|
|||
propertyValidator = string().email().nullable()
|
||||
break
|
||||
case "password":
|
||||
propertyValidator = string().min(8)
|
||||
propertyValidator = string().nullable()
|
||||
break
|
||||
default:
|
||||
propertyValidator = string().nullable()
|
||||
|
@ -45,6 +45,13 @@ export const createValidationStore = () => {
|
|||
propertyValidator = propertyValidator.required()
|
||||
}
|
||||
|
||||
// We want to do this after the possible required validation, to prioritise the required error
|
||||
switch (type) {
|
||||
case "password":
|
||||
propertyValidator = propertyValidator.min(8)
|
||||
break
|
||||
}
|
||||
|
||||
validator[propertyName] = propertyValidator
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue