Use nullable
This commit is contained in:
parent
91fe9ff387
commit
a322f13b59
|
@ -28,15 +28,13 @@ export const createValidationStore = () => {
|
||||||
let propertyValidator
|
let propertyValidator
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "number":
|
case "number":
|
||||||
propertyValidator = number().transform(value =>
|
propertyValidator = number().nullable()
|
||||||
isNaN(value) ? undefined : value
|
|
||||||
)
|
|
||||||
break
|
break
|
||||||
case "email":
|
case "email":
|
||||||
propertyValidator = string().email()
|
propertyValidator = string().email().nullable()
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
propertyValidator = string()
|
propertyValidator = string().nullable()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (required) {
|
if (required) {
|
||||||
|
|
Loading…
Reference in New Issue