diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index d87f6c402..d5de60f16 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -53,7 +53,7 @@ const tableRef = ref([]); watch( () => route.params.id, - async () => await getSales() + () => tableRef.value.reload() ); const columns = computed(() => [ @@ -161,15 +161,6 @@ const onSalesFetched = (salesData) => { for (let sale of salesData) sale.amount = getSaleTotal(sale); }; -const getSales = async () => { - try { - const { data } = await axios.get(`Tickets/${route.params.id}/getSales`); - onSalesFetched(data); - } catch (err) { - console.error('Error fetching sales', err); - } -}; - const getSaleTotal = (sale) => { if (sale.quantity == null || sale.price == null) return null; @@ -181,7 +172,7 @@ const getSaleTotal = (sale) => { const resetChanges = async () => { arrayData.fetch({ append: false }); - getSales(); + tableRef.value.reload(); }; const updateQuantity = async (sale) => { @@ -434,7 +425,6 @@ const setTransferParams = async () => { onMounted(async () => { stateStore.rightDrawer = true; getConfig(); - getSales(); getItems(); }); @@ -623,6 +613,7 @@ watch( :column-search="false" :disable-option="{ card: true }" auto-load + @on-fetch="onSalesFetched" :create="{ onDataSaved: handleOnDataSave, }"