Update MyInvoices.js
This commit is contained in:
parent
5fc9294786
commit
67016e388f
@ -41,8 +41,8 @@ const MyInvoices = () => {
|
|||||||
cancelButtonText: 'Non',
|
cancelButtonText: 'Non',
|
||||||
}).then(async (result) => {
|
}).then(async (result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
fetch(`https://localhost:7292/api/Invoice?id=${id}`, {
|
fetch(`https://localhost:7292/api/Invoice/Cancel/${id}`, {
|
||||||
method: 'CANCEL',
|
method: 'POST',
|
||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
@ -51,11 +51,16 @@ const MyInvoices = () => {
|
|||||||
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
|
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
|
||||||
|
|
||||||
onShowAlert('Suppression de la commande avec succès!', 2000);
|
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 {
|
else {
|
||||||
mySwal.fire({
|
mySwal.fire({
|
||||||
title: `Erreur lors de la suppression de la commande...`,
|
title: `Erreur lors de la suppression de la commande...`,
|
||||||
text: `L'erreur: ${response}`,
|
text: `L'erreur: ${await response.json()}`,
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user