Skip to content

Commit

Permalink
[5.x] Improve error handling when using entry publish actions (#11289)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
ryanmitchell and jasonvarga authored Dec 19, 2024
1 parent 45d8f85 commit 0b6e0d2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion resources/js/components/entries/PublishActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,20 @@ export default {
},
handleAxiosError(e) {
if (e.response && e.response.status === 422) {
const { message, errors } = e.response.data;
this.error = message;
this.errors = errors;
this.$toast.error(message);
this.$reveal.invalid();
} else if (e.response) {
this.$toast.error(e.response.data.message);
} else {
this.$toast.error(e || 'Something went wrong');
}
this.saving = false;
this.$toast.error(e || __('Something went wrong'));
this.$emit('failed');
}
}
Expand Down

0 comments on commit 0b6e0d2

Please sign in to comment.