docs(form): update (#2167)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Romain Hamel
2024-09-12 15:47:58 +02:00
committed by GitHub
parent 1667e5a655
commit 319fce136f
13 changed files with 698 additions and 11 deletions

View File

@@ -147,7 +147,8 @@ async function _validate(opts: { name?: string | string[], silent?: boolean, nes
errors.value = await getErrors()
}
const childErrors = nestedValidatePromises ? await Promise.all(nestedValidatePromises) : []
const childErrors = (await Promise.all(nestedValidatePromises)).filter(val => val)
if (errors.value.length + childErrors.length > 0) {
if (opts.silent) return false
throw new FormValidationException(formId, errors.value, childErrors)
@@ -173,7 +174,6 @@ async function onSubmit(payload: Event) {
errors: error.errors,
childrens: error.childrens
}
emits('error', errorEvent)
}
}