Use nullable
This commit is contained in:
parent
91fe9ff387
commit
a322f13b59
1 changed files with 3 additions and 5 deletions
|
@ -28,15 +28,13 @@ export const createValidationStore = () => {
|
|||
let propertyValidator
|
||||
switch (type) {
|
||||
case "number":
|
||||
propertyValidator = number().transform(value =>
|
||||
isNaN(value) ? undefined : value
|
||||
)
|
||||
propertyValidator = number().nullable()
|
||||
break
|
||||
case "email":
|
||||
propertyValidator = string().email()
|
||||
propertyValidator = string().email().nullable()
|
||||
break
|
||||
default:
|
||||
propertyValidator = string()
|
||||
propertyValidator = string().nullable()
|
||||
}
|
||||
|
||||
if (required) {
|
||||
|
|
Loading…
Reference in a new issue