From 33596177f6de8ad004bf61a0f5659476713e7a3d Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Tue, 8 Nov 2022 07:37:26 -0500 Subject: [PATCH 1/2] it kinda does le wookrdkkkdjdsolkhghbalkjblkgjvcb lkshjdvb kjdbk --- .../grosses-mitaines-ui/src/pages/Formulaire.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js index c3cd565..27516fe 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js @@ -60,17 +60,20 @@ export default function App() { else { data.prodQuant ={}; cart.map((p) => { - data.prodQuant[p.id] = p.quantity; + data.prodQuant[`${p.id}`] = p.quantity; }); - console.log(data); - + const jsonData = JSON.stringify(data); - + + console.log(jsonData); fetch("https://localhost:7292/api/Invoice", { mode: "cors", method: "POST", credentials: "include", + headers:{ + 'Content-Type': 'application/json' + }, body: jsonData }).then((response) => { console.log(response); From 5f4a488274336c8e36d7d5a29544d4579ffb5894 Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Tue, 8 Nov 2022 07:43:48 -0500 Subject: [PATCH 2/2] BAGUETTE :bread: --- .../grosses-mitaines-ui/src/components/App.js | 2 +- .../src/pages/Formulaire.js | 19 +++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js index 5618883..22d56e6 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js @@ -52,7 +52,7 @@ const App = () => { } /> } /> } /> - } /> + } /> diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js index 27516fe..f410c27 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Formulaire.js @@ -58,26 +58,13 @@ export default function App() { console.log("Your cart is empty!!!"); } else { - data.prodQuant ={}; + data.prodQuant = {}; cart.map((p) => { data.prodQuant[`${p.id}`] = p.quantity; }); - - const jsonData = JSON.stringify(data); - - console.log(jsonData); - fetch("https://localhost:7292/api/Invoice", { - mode: "cors", - method: "POST", - credentials: "include", - headers:{ - 'Content-Type': 'application/json' - }, - body: jsonData - }).then((response) => { - console.log(response); - }); + cookies.set('invoice', data, { path: '/', SameSite: 'strict', secure: true, maxAge: 2592000 }); + navigate("/reviewinvoice"); } }