Skip to content

Commit

Permalink
Copy handleAxiosError from PublishForm
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Dec 19, 2024
1 parent 45d8f85 commit e09812a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions resources/js/components/entries/PublishActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,17 @@ export default {
},
handleAxiosError(e) {
this.saving = false;
this.$toast.error(e || __('Something went wrong'));
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');
}
}
}
Expand Down

0 comments on commit e09812a

Please sign in to comment.