Update MyInvoices.js
This commit is contained in:
parent
5fc9294786
commit
67016e388f
@ -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',
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user