Add content type json to all fetch ajax endpoints

This commit is contained in:
Emili Castells Guasch 2023-03-22 17:26:58 +01:00
parent 5ceb39c9e0
commit 8d97954f42
7 changed files with 21 additions and 0 deletions

View file

@ -49,6 +49,9 @@ class FreeTrialHandler {
const res = await fetch(this.config.ajax.vault_paypal.endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.config.ajax.vault_paypal.nonce,

View file

@ -27,6 +27,9 @@ const storeToken = (token) => {
const dataClientIdAttributeHandler = (script, config) => {
fetch(config.endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify({
nonce: config.nonce

View file

@ -10,6 +10,9 @@ export default class FormSaver {
const res = await fetch(this.url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.nonce,

View file

@ -10,6 +10,9 @@ export default class FormValidator {
const res = await fetch(this.url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.nonce,

View file

@ -20,6 +20,9 @@ class UpdateCart {
this.endpoint,
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.nonce,