fix: duplicate call
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-09-30 14:35:10 +02:00
parent 9d7db2020b
commit 76a77dcee9
1 changed files with 3 additions and 12 deletions

View File

@ -53,7 +53,7 @@ const tableRef = ref([]);
watch( watch(
() => route.params.id, () => route.params.id,
async () => await getSales() () => tableRef.value.reload()
); );
const columns = computed(() => [ const columns = computed(() => [
@ -161,15 +161,6 @@ const onSalesFetched = (salesData) => {
for (let sale of salesData) sale.amount = getSaleTotal(sale); 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) => { const getSaleTotal = (sale) => {
if (sale.quantity == null || sale.price == null) return null; if (sale.quantity == null || sale.price == null) return null;
@ -181,7 +172,7 @@ const getSaleTotal = (sale) => {
const resetChanges = async () => { const resetChanges = async () => {
arrayData.fetch({ append: false }); arrayData.fetch({ append: false });
getSales(); tableRef.value.reload();
}; };
const updateQuantity = async (sale) => { const updateQuantity = async (sale) => {
@ -434,7 +425,6 @@ const setTransferParams = async () => {
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
getConfig(); getConfig();
getSales();
getItems(); getItems();
}); });
@ -623,6 +613,7 @@ watch(
:column-search="false" :column-search="false"
:disable-option="{ card: true }" :disable-option="{ card: true }"
auto-load auto-load
@on-fetch="onSalesFetched"
:create="{ :create="{
onDataSaved: handleOnDataSave, onDataSaved: handleOnDataSave,
}" }"