qiniu / formstate-x

Manage state of form with ease.
https://qiniu.github.io/formstate-x
MIT License
34 stars 10 forks source link

Provide error info along with hasError in return value of method validate #15

Closed nighca closed 4 years ago

nighca commented 4 years ago

Provide error info along with hasError in the return value of method validate of FieldState & FormState:

const res = await state.validate()

if (res.hasError) {
  alert(res.error) // put the error info in field `res.error`
  return
}

submit(res.value)