Skip to content

Commit 71fef71

Browse files
duncanmccleanclaudejasonvarga
authored
[6.x] Catch axios errors in blueprint builder (#14428)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Jason Varga <jason@pixelfear.com>
1 parent b4f659c commit 71fef71

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

resources/js/components/fields/FieldtypeSelector.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,12 @@ export default {
229229
230230
if (this.$config.get('isFormBlueprint')) url += '&forms=true';
231231
232-
this.$axios.get(url).then((response) => (loadedFieldtypes.value = response.data));
232+
this.$axios.get(url)
233+
.then((response) => (loadedFieldtypes.value = response.data))
234+
.catch((e) => {
235+
this.$toast.error(e.response?.data?.message || __('Something went wrong'));
236+
this.close();
237+
});
233238
},
234239
235240
methods: {

resources/js/components/fields/Settings.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ export default {
366366
this.errors = errors;
367367
this.$toast.error(message);
368368
} else {
369-
this.$toast.error(__('Something went wrong'));
369+
this.$toast.error(e.response?.data?.message || __('Something went wrong'));
370370
}
371371
},
372372
@@ -396,6 +396,10 @@ export default {
396396
this.meta = { ...response.data.meta };
397397
this.originValues = response.data.originValues;
398398
this.originMeta = response.data.originMeta;
399+
})
400+
.catch((e) => {
401+
this.loading = false;
402+
this.handleAxiosError(e);
399403
});
400404
},
401405
},

resources/js/components/publish/FieldMeta.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,18 @@ export default {
6060
value: this.value,
6161
};
6262
63-
this.$axios.post(cp_url('fields/field-meta'), params).then((response) => {
64-
this.meta = response.data.meta;
65-
this.value = response.data.value;
66-
this.loading = false;
67-
this.$emit('loaded');
68-
});
63+
this.$axios
64+
.post(cp_url('fields/field-meta'), params)
65+
.then((response) => {
66+
this.meta = response.data.meta;
67+
this.value = response.data.value;
68+
this.loading = false;
69+
this.$emit('loaded');
70+
})
71+
.catch((e) => {
72+
this.loading = false;
73+
this.$toast.error(e.response?.data?.message || __('Something went wrong'));
74+
});
6975
},
7076
7177
updateMeta(value) {

0 commit comments

Comments
 (0)