From 9e2aa6f8c8a02b19dea18405114e54abb3507202 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 24 Aug 2026 14:43:13 +0300 Subject: [PATCH] pass fetch options --- app/javascript/submission_form/form.vue | 3 +++ app/javascript/submission_form/kba_step.vue | 13 ++++++++++--- app/javascript/submission_form/payment_step.vue | 11 +++++++++-- .../submission_form/verification_step.vue | 11 +++++++++-- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index ba7c3768..61ae047c 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -560,6 +560,7 @@ :fields="formulaFields" :values="values" :readonly-values="readonlyFieldValues" + :fetch-options="fetchOptions" :provider="paymentProvider" @attached="attachments.push($event)" @focus="scrollIntoField(currentField)" @@ -573,6 +574,7 @@ :empty-value-required-step="emptyValueRequiredStep" :field="currentField" :submitter-slug="submitterSlug" + :fetch-options="fetchOptions" :values="values" @submit="!isSubmitting && submitStep()" /> @@ -585,6 +587,7 @@ :empty-value-required-step="emptyValueRequiredStep" :field="currentField" :submitter-slug="submitterSlug" + :fetch-options="fetchOptions" :values="values" @focus="scrollIntoField(currentField)" @submit="!isSubmitting && submitStep()" diff --git a/app/javascript/submission_form/kba_step.vue b/app/javascript/submission_form/kba_step.vue index 1c98f1af..bb2ac672 100644 --- a/app/javascript/submission_form/kba_step.vue +++ b/app/javascript/submission_form/kba_step.vue @@ -312,6 +312,11 @@ export default { values: { type: Object, required: true + }, + fetchOptions: { + type: Object, + required: false, + default: () => ({}) } }, emits: ['submit'], @@ -494,8 +499,9 @@ export default { const resp = await fetch(this.baseUrl + '/api/kba', { method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(payload) + body: JSON.stringify(payload), + ...this.fetchOptions, + headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } }) const data = await resp.json() @@ -550,7 +556,8 @@ export default { reference: this.reference, submitter_slug: this.submitterSlug }), - headers: { 'Content-Type': 'application/json' } + ...this.fetchOptions, + headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } }) const data = await resp.json() diff --git a/app/javascript/submission_form/payment_step.vue b/app/javascript/submission_form/payment_step.vue index f1ebabcc..ab015954 100644 --- a/app/javascript/submission_form/payment_step.vue +++ b/app/javascript/submission_form/payment_step.vue @@ -121,6 +121,11 @@ export default { type: String, required: false, default: '' + }, + fetchOptions: { + type: Object, + required: false, + default: () => ({}) } }, emits: ['focus', 'submit', 'update:model-value', 'attached'], @@ -234,7 +239,8 @@ export default { body: JSON.stringify({ submitter_slug: this.submitterSlug }), - headers: { 'Content-Type': 'application/json' } + ...this.fetchOptions, + headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } }).then(async (resp) => { if (resp.status === 422 || resp.status === 500) { this.isProcessing = false @@ -274,7 +280,8 @@ export default { check_status: checkStatus, referer: this.normalizedPaymentUrl() }), - headers: { 'Content-Type': 'application/json' } + ...this.fetchOptions, + headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } }).then(async (resp) => { if (resp.status === 422 || resp.status === 500) { const data = await resp.json() diff --git a/app/javascript/submission_form/verification_step.vue b/app/javascript/submission_form/verification_step.vue index 59ae6c4c..20c5c960 100644 --- a/app/javascript/submission_form/verification_step.vue +++ b/app/javascript/submission_form/verification_step.vue @@ -91,6 +91,11 @@ export default { submitterSlug: { type: String, required: true + }, + fetchOptions: { + type: Object, + required: false, + default: () => ({}) } }, emits: ['focus', 'submit', 'update:model-value', 'attached'], @@ -163,7 +168,8 @@ export default { submitter_slug: this.submitterSlug, redirect_url: document.location.href }), - headers: { 'Content-Type': 'application/json' } + ...this.fetchOptions, + headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } }).then(async (resp) => { this.eidEasyData = await resp.json() @@ -205,7 +211,8 @@ export default { body: JSON.stringify({ submitter_slug: this.submitterSlug }), - headers: { 'Content-Type': 'application/json' } + ...this.fetchOptions, + headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } }) if (resp.status === 404) {