1
0
Fork 0
mirror of synced 2024-07-09 00:06:05 +12:00

Fix validation order

This commit is contained in:
Adria Navarro 2023-06-13 13:07:41 +01:00
parent d041ad621f
commit 5f3335c566

View file

@ -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
}