From d3bb6dff61a31c7d42d3989840ef107a4fcb1971 Mon Sep 17 00:00:00 2001 From: Duncan McClean <19637309+duncanmcclean@users.noreply.github.com> Date: Thu, 2 Nov 2023 18:23:11 +0000 Subject: [PATCH] [4.x] Handle unauthorized response in Inline Publish Form (#8918) --- .../inputs/relationship/InlinePublishForm.vue | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/resources/js/components/inputs/relationship/InlinePublishForm.vue b/resources/js/components/inputs/relationship/InlinePublishForm.vue index 7711035e75..b7be07963e 100644 --- a/resources/js/components/inputs/relationship/InlinePublishForm.vue +++ b/resources/js/components/inputs/relationship/InlinePublishForm.vue @@ -69,14 +69,20 @@ export default { methods: { getItem() { - this.$axios.get(this.itemUrl).then(response => { - for (const prop in this.componentProps) { - const value = data_get(response.data, this.componentProps[prop]); - this.$set(this.componentPropValues, prop, value); - } - - this.loading = false; - }); + this.$axios.get(this.itemUrl) + .then(response => { + for (const prop in this.componentProps) { + const value = data_get(response.data, this.componentProps[prop]); + this.$set(this.componentPropValues, prop, value); + } + + this.loading = false; + }).catch((error) => { + if (error.response.status === 403) { + this.$toast.error(__('This action is unauthorized.')); + this.close(); + } + }); }, close() {