pass fetch options

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

@ -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()"

@ -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()

@ -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()

@ -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) {

Loading…
Cancel
Save