From eb4cdd84e01919ede50c136c6a0914ad3bc22803 Mon Sep 17 00:00:00 2001 From: Sebastien Hattry Date: Fri, 11 Feb 2022 16:11:28 +0100 Subject: [PATCH] debrief-mail-22-02-09 --- app/Http/Controllers/EnterCodeController.php | 9 ++++----- public/js/app.js | 5 ++++- resources/js/bootstrap.js | 7 +++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/EnterCodeController.php b/app/Http/Controllers/EnterCodeController.php index 9c38c65..db56358 100644 --- a/app/Http/Controllers/EnterCodeController.php +++ b/app/Http/Controllers/EnterCodeController.php @@ -250,11 +250,10 @@ class EnterCodeController extends Controller $mesBR->updateContact($crmUser->user); $result = $mesBR->updatePanier($crmUser->user, $coupon); if ($result["status"] === "OK") { - $reduction = new Reduction(); - $reduction->participation_id = $participation->id; - $reduction->link = $result["link"]; - $reduction->verification = $result["verif"]; - $reduction->basket_id = $result["basketId"]; + $reduction = new Reduction(); + $reduction->link = $result["link"]; + $reduction->verification = $result["verif"]; + $reduction->basket_id = $result["basketId"]; $reduction->save(); $participation->reduction_id = $reduction->id; $participation->save(); diff --git a/public/js/app.js b/public/js/app.js index 2be4e51..1248bad 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -9317,7 +9317,10 @@ try { window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); -window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; +window.axios.defaults.headers.common = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content') +}; /** * Echo exposes an expressive API for subscribing to channels and listening * for events that are broadcast by Laravel. Echo and event broadcasting diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 63605fa..64f1323 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -11,7 +11,7 @@ try { window.$ = window.jQuery = require('jquery'); require('bootstrap'); -} catch (e) {} +} catch (e) { } /** * We'll load the axios HTTP library which allows us to easily issue requests @@ -21,7 +21,10 @@ try { window.axios = require('axios'); -window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; +window.axios.defaults.headers.common = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content') +}; /** * Echo exposes an expressive API for subscribing to channels and listening