|
|
@@ -113,7 +113,13 @@
|
|
|
fetch('https://bartender.mixtab.com.br/order/delete', requestOptions)
|
|
|
.then((response) => response.json())
|
|
|
.then((result) => {
|
|
|
- //(console.log('Pedido cancelado com sucesso:', order_Id, companyId, result), fetchOrders());
|
|
|
+ if (result.status === 'ok') {
|
|
|
+ // Remove the canceled order from the local orders array
|
|
|
+ orders = orders.filter(order => order.id !== order_Id);
|
|
|
+ console.log('Pedido cancelado com sucesso:', order_Id);
|
|
|
+ } else {
|
|
|
+ console.error('Erro ao cancelar comanda:', result.msg);
|
|
|
+ }
|
|
|
})
|
|
|
.catch((error) => console.error('Erro ao cancelar comanda:', error));
|
|
|
}
|