Explicitly send cookies in fetch

Not sent by default in old browsers
This commit is contained in:
Alex P 2022-09-09 16:28:58 +03:00
parent 5be88678e7
commit 23cb96e6f9
12 changed files with 15 additions and 1 deletions

View file

@ -16,6 +16,7 @@ class CartActionHandler {
this.config.bn_codes[this.config.context] : '';
return fetch(this.config.ajax.create_order.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.config.ajax.create_order.nonce,
purchase_units: [],

View file

@ -31,6 +31,7 @@ class CheckoutActionHandler {
return fetch(this.config.ajax.create_order.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.config.ajax.create_order.nonce,
payer,

View file

@ -18,6 +18,7 @@ class FreeTrialHandler {
fetch(this.config.ajax.vault_paypal.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.config.ajax.vault_paypal.nonce,
return_url: location.href

View file

@ -80,6 +80,7 @@ class SingleProductActionHandler {
this.config.bn_codes[this.config.context] : '';
return fetch(this.config.ajax.create_order.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.config.ajax.create_order.nonce,
purchase_units,

View file

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

View file

@ -20,6 +20,7 @@ class UpdateCart {
this.endpoint,
{
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.nonce,
products,
@ -42,4 +43,4 @@ class UpdateCart {
}
}
export default UpdateCart;
export default UpdateCart;

View file

@ -2,6 +2,7 @@ const onApprove = (context, errorHandler) => {
return (data, actions) => {
return fetch(context.config.ajax.approve_order.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: context.config.ajax.approve_order.nonce,
order_id:data.orderID,

View file

@ -5,6 +5,7 @@ const onApprove = (context, errorHandler, spinner) => {
return fetch(context.config.ajax.approve_order.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: context.config.ajax.approve_order.nonce,
order_id:data.orderID,

View file

@ -80,6 +80,7 @@ const ppcp_onboarding = {
fetch(PayPalCommerceGatewayOnboarding.pui_endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: PayPalCommerceGatewayOnboarding.pui_nonce,
checked: onboard_pui.checked

View file

@ -20,6 +20,7 @@ document.addEventListener(
submitButton.setAttribute('disabled', 'disabled');
fetch(config.ajax.tracking_info.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: config.ajax.tracking_info.nonce,
transaction_id: transactionId ? transactionId.value : null,

View file

@ -10,6 +10,7 @@ document.addEventListener(
PayPalCommerceGatewayVaulting.delete.endpoint,
{
method: 'POST',
credentials: 'same-origin',
headers: {
'content-type': 'application/json'
},

View file

@ -10,6 +10,7 @@ document.addEventListener(
PayPalCommerceGatewayWebhooksStatus.resubscribe.endpoint,
{
method: 'POST',
credentials: 'same-origin',
headers: {
'content-type': 'application/json'
},
@ -52,6 +53,7 @@ document.addEventListener(
PayPalCommerceGatewayWebhooksStatus.simulation.start.endpoint,
{
method: 'POST',
credentials: 'same-origin',
headers: {
'content-type': 'application/json'
},
@ -106,6 +108,7 @@ document.addEventListener(
PayPalCommerceGatewayWebhooksStatus.simulation.state.endpoint,
{
method: 'GET',
credentials: 'same-origin',
}
);