Skip to content

Commit

Permalink
fix: change to umbracoforms response handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tfjordside committed Dec 7, 2023
1 parent 70605fe commit c5b5de8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions components/UmbracoForms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1556,18 +1556,21 @@ export default {
},
body: JSON.stringify(data),
});
if (response.status === 202 || response.status === 204) {
const json = await response.json();
if (json.status === 202 || json.status === 204) {
this.formIsLoading = false;
this.formSuccess = true;
} else if (response.status === 422) {
} else if (json.status === 422) {
this.formIsLoading = false;
this.formErrors = response.errors;
this.formErrors = json.errors;
let goToPage = null;
/* eslint-disable */
for (const [key] of Object.entries(response.errors)) {
for (const [key] of Object.entries(json.errors)) {
const field = this.flatFields.find(field => field.alias === key);
if (field.page < goToPage || goToPage === null) {
if (field && field.page < goToPage || field && goToPage === null) {
goToPage = field.page;
}
}
Expand Down

0 comments on commit c5b5de8

Please sign in to comment.