pass fetch options

pull/718/head
Pete Matsyburka 4 weeks ago
parent 11c76bf554
commit 9e2aa6f8c8

@ -560,6 +560,7 @@
:fields="formulaFields" :fields="formulaFields"
:values="values" :values="values"
:readonly-values="readonlyFieldValues" :readonly-values="readonlyFieldValues"
:fetch-options="fetchOptions"
:provider="paymentProvider" :provider="paymentProvider"
@attached="attachments.push($event)" @attached="attachments.push($event)"
@focus="scrollIntoField(currentField)" @focus="scrollIntoField(currentField)"
@ -573,6 +574,7 @@
:empty-value-required-step="emptyValueRequiredStep" :empty-value-required-step="emptyValueRequiredStep"
:field="currentField" :field="currentField"
:submitter-slug="submitterSlug" :submitter-slug="submitterSlug"
:fetch-options="fetchOptions"
:values="values" :values="values"
@submit="!isSubmitting && submitStep()" @submit="!isSubmitting && submitStep()"
/> />
@ -585,6 +587,7 @@
:empty-value-required-step="emptyValueRequiredStep" :empty-value-required-step="emptyValueRequiredStep"
:field="currentField" :field="currentField"
:submitter-slug="submitterSlug" :submitter-slug="submitterSlug"
:fetch-options="fetchOptions"
:values="values" :values="values"
@focus="scrollIntoField(currentField)" @focus="scrollIntoField(currentField)"
@submit="!isSubmitting && submitStep()" @submit="!isSubmitting && submitStep()"

@ -312,6 +312,11 @@ export default {
values: { values: {
type: Object, type: Object,
required: true required: true
},
fetchOptions: {
type: Object,
required: false,
default: () => ({})
} }
}, },
emits: ['submit'], emits: ['submit'],
@ -494,8 +499,9 @@ export default {
const resp = await fetch(this.baseUrl + '/api/kba', { const resp = await fetch(this.baseUrl + '/api/kba', {
method: 'POST', 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() const data = await resp.json()
@ -550,7 +556,8 @@ export default {
reference: this.reference, reference: this.reference,
submitter_slug: this.submitterSlug submitter_slug: this.submitterSlug
}), }),
headers: { 'Content-Type': 'application/json' } ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
}) })
const data = await resp.json() const data = await resp.json()

@ -121,6 +121,11 @@ export default {
type: String, type: String,
required: false, required: false,
default: '' default: ''
},
fetchOptions: {
type: Object,
required: false,
default: () => ({})
} }
}, },
emits: ['focus', 'submit', 'update:model-value', 'attached'], emits: ['focus', 'submit', 'update:model-value', 'attached'],
@ -234,7 +239,8 @@ export default {
body: JSON.stringify({ body: JSON.stringify({
submitter_slug: this.submitterSlug submitter_slug: this.submitterSlug
}), }),
headers: { 'Content-Type': 'application/json' } ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
}).then(async (resp) => { }).then(async (resp) => {
if (resp.status === 422 || resp.status === 500) { if (resp.status === 422 || resp.status === 500) {
this.isProcessing = false this.isProcessing = false
@ -274,7 +280,8 @@ export default {
check_status: checkStatus, check_status: checkStatus,
referer: this.normalizedPaymentUrl() referer: this.normalizedPaymentUrl()
}), }),
headers: { 'Content-Type': 'application/json' } ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
}).then(async (resp) => { }).then(async (resp) => {
if (resp.status === 422 || resp.status === 500) { if (resp.status === 422 || resp.status === 500) {
const data = await resp.json() const data = await resp.json()

@ -91,6 +91,11 @@ export default {
submitterSlug: { submitterSlug: {
type: String, type: String,
required: true required: true
},
fetchOptions: {
type: Object,
required: false,
default: () => ({})
} }
}, },
emits: ['focus', 'submit', 'update:model-value', 'attached'], emits: ['focus', 'submit', 'update:model-value', 'attached'],
@ -163,7 +168,8 @@ export default {
submitter_slug: this.submitterSlug, submitter_slug: this.submitterSlug,
redirect_url: document.location.href redirect_url: document.location.href
}), }),
headers: { 'Content-Type': 'application/json' } ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
}).then(async (resp) => { }).then(async (resp) => {
this.eidEasyData = await resp.json() this.eidEasyData = await resp.json()
@ -205,7 +211,8 @@ export default {
body: JSON.stringify({ body: JSON.stringify({
submitter_slug: this.submitterSlug submitter_slug: this.submitterSlug
}), }),
headers: { 'Content-Type': 'application/json' } ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
}) })
if (resp.status === 404) { if (resp.status === 404) {

Loading…
Cancel
Save