From 5f57c53ed0cdb40233afcba80423d3eb58947841 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 7 Oct 2025 14:47:34 +0200 Subject: [PATCH] Api.js: better error handling --- public/js/plugins/Api.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/js/plugins/Api.js b/public/js/plugins/Api.js index 0b8e2fd17..895ecf70d 100644 --- a/public/js/plugins/Api.js +++ b/public/js/plugins/Api.js @@ -328,6 +328,7 @@ export default { url: error.request.responseURL }]; } else { + if (error.response.data.errors == undefined) return []; return error.response.data.errors; } } else if (error.request) { @@ -346,6 +347,9 @@ export default { function popHandleableErrors(errorHandling, errors) { const result = {}; const copy = []; + + if (errors == undefined) return {}; + while (errors.length) copy.push(errors.pop()); for (var error of copy) { @@ -551,4 +555,4 @@ export default { app.provide('$api', app.config.globalProperties.$api); } -}; \ No newline at end of file +};