From 94ca6d34c3e9d8ec31f7634c70ee7fc322394a64 Mon Sep 17 00:00:00 2001 From: Hugo Duval <42731924+hdasdoria@users.noreply.github.com> Date: Thu, 1 Sep 2022 16:50:20 +0200 Subject: [PATCH] fix window reload on javascript payment callbacks --- src/Resources/views/payWithPaypal.html.twig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Resources/views/payWithPaypal.html.twig b/src/Resources/views/payWithPaypal.html.twig index 38d65dbc..3c0ef135 100644 --- a/src/Resources/views/payWithPaypal.html.twig +++ b/src/Resources/views/payWithPaypal.html.twig @@ -268,7 +268,7 @@ method: 'post', headers: {}, body: error - }).then(window.location.reload()); + }).then(() => window.location.reload()); }, onShippingChange: function(data, actions) { if (!availableCountries.filter(country => country === data.shipping_address.country_code).length) { @@ -292,7 +292,7 @@ method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ payPalOrderId: data.orderID }) - }).then(window.location.reload()); + }).then(() => window.location.reload()); } }).render('#paypal-button-container'); @@ -319,14 +319,14 @@ method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify(err) - }).then(window.location.reload()); + }).then(() => window.location.reload()); }, onCancel: function (data, actions) { return fetch(cancelPayPalPaymentUrl, { method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ payPalOrderId: data.orderID }) - }).then(window.location.reload()); + }).then(() => window.location.reload()); } }); @@ -451,7 +451,7 @@ method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ payPalOrderId: data.orderID }) - }).then(window.location.reload()); + }).then(() => window.location.reload()); } window.location.href = data.return_url; @@ -468,7 +468,7 @@ method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ payPalOrderId: processingOrderId }) - }).then(window.location.reload()); + }).then(() => window.location.reload()); }); }); } else {