Skip to content

Commit

Permalink
onLoadFailure event
Browse files Browse the repository at this point in the history
  • Loading branch information
dimailn committed Jul 24, 2023
1 parent 2854ff3 commit b05a1f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/descriptors/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ export default {
this.$emit('after-load-success')
this.executeEffectEventOptional('onLoaded', false, [])
})
.catch((e) => {
this.$emit('after-load-failure')
this.executeEffectEventOptional('onLoadFailure', false, [])
return Promise.reject(e)
})
.finally(() => {
this.setSyncProp('errors', {});
this.setSyncProp('fetching', false);
Expand Down Expand Up @@ -970,7 +975,8 @@ export default {
'onValidate',
'onFailure',
'onSuccess',
'onLoaded'
'onLoaded',
'onLoadFailure'
]

this.instantiatedEffects = this.$effects.map(({effect, name, api}: Effect) => {
Expand Down
1 change: 1 addition & 0 deletions src/types/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface EffectContextBuiltinListeners {
onFailure: (listener: (event: Event<{errors: any}>) => object) => void
onSuccess: (listener: () => void) => void
onLoaded: (listener: () => void) => void
onLoadFailure: (listener: () => void) => void
}

type EffectContext = {
Expand Down

0 comments on commit b05a1f6

Please sign in to comment.