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', }); }