mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 07:52:16 +00:00
Api.js: better error handling
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user