Skip to content

v3.0.0

Latest
Compare
Choose a tag to compare
@pavelivanov pavelivanov released this 02 Apr 15:56
· 10 commits to master since this release

Form.submit and FormGroup.submit result format changed. Beware updating to this version!

< 3.0.0

form.submit()
  .then((values) => {

  })
  .catch((errors) => {
    // validation errors
  })

or

try {
  const values = await form.submit()
}
catch (errors) {
  // validation errors
}

>= 3.0.0

form.submit()
  .then(({ values, errors }) => {
    if (errors) {
       // handle errors
    }
    else {
       // do smth
    }
  })

or

const { values, errors } = await form.submit()

The Reason

try {
   const values = await form.submit()

   // other code that can cause an error
}
catch (errors) {
   // errors can contain not only form validation errors but any type of error from code after form.submit()
}