From 67016e388f93120d5c15901381bb50c52329b309 Mon Sep 17 00:00:00 2001 From: DavidBelisle <79233327+DavidBelisle@users.noreply.github.com> Date: Wed, 23 Nov 2022 15:56:55 -0500 Subject: [PATCH] Update MyInvoices.js --- .../grosses-mitaines-ui/src/pages/MyInvoices.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/MyInvoices.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/MyInvoices.js index c9e5411..a26d777 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/MyInvoices.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/MyInvoices.js @@ -41,8 +41,8 @@ const MyInvoices = () => { cancelButtonText: 'Non', }).then(async (result) => { if (result.isConfirmed) { - fetch(`https://localhost:7292/api/Invoice?id=${id}`, { - method: 'CANCEL', + fetch(`https://localhost:7292/api/Invoice/Cancel/${id}`, { + method: 'POST', mode: 'cors', credentials: 'include' }).then(async (response) => { @@ -51,11 +51,16 @@ const MyInvoices = () => { setInvoices(invoices.filter((invoice) => invoice.id !== deletedId)); onShowAlert('Suppression de la commande avec succès!', 2000); + mySwal.fire({ + title: `Commande annulée...`, + text: `La commande a été annulée!`, + icon: 'success', + }); } else { mySwal.fire({ title: `Erreur lors de la suppression de la commande...`, - text: `L'erreur: ${response}`, + text: `L'erreur: ${await response.json()}`, icon: 'error', }); }