Skip to content

Commit

Permalink
Modify validate error handling to support multiple response formats.
Browse files Browse the repository at this point in the history
  • Loading branch information
oakdbca committed Oct 16, 2024
1 parent b506d87 commit 9a81e2d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,15 @@ export default {
})
})
.catch(error => {
let errors = error.data
let error_message = ''
let errors = null;
if (Object.hasOwn(error, 'data')) {
errors = error.data
} else if (Object.hasOwn(error, 'body')) {
errors = error.body
}
let error_message = 'Something went wrong :-('
if (errors instanceof Array) {
error_message = ''
for (let i = 0; i < errors.length; i++) {
error_message += `<li class="mb-2">${errors[i].error_message}</li>`
}
Expand Down

0 comments on commit 9a81e2d

Please sign in to comment.