Skip to content

Commit

Permalink
fix Form.submit miss return values (#1382)
Browse files Browse the repository at this point in the history
  • Loading branch information
linfaxin authored May 11, 2021
1 parent b6ac9f2 commit 57c2c1b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/models/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,14 @@ export class Form<ValueType extends object = any> {
this.notify(LifeCycleTypes.ON_FORM_SUBMIT_VALIDATE_END)
let results: any
try {
if (isFn(onSubmit) && this.valid) {
results = await onSubmit(toJS(this.values))
} else if (this.invalid) {
if (this.invalid) {
throw this.errors
}
if (isFn(onSubmit)) {
results = await onSubmit(toJS(this.values))
} else {
results = toJS(this.values)
}
this.notify(LifeCycleTypes.ON_FORM_SUBMIT_SUCCESS)
} catch (e) {
this.setSubmitting(false)
Expand Down

0 comments on commit 57c2c1b

Please sign in to comment.