analytics + categories sort in creation + auto focus on sum

This commit is contained in:
Vladimir Voronin
2025-01-12 14:15:09 +03:00
parent 60934d4335
commit 086015001e
4 changed files with 71 additions and 261 deletions

View File

@@ -21,13 +21,12 @@ const allLoaded = ref(false); // Флаг для отслеживания око
// Функция для получения транзакций с параметрами limit и offset
const fetchTransactions = async (reload) => {
console.log("here")
console.log(allLoaded.value)
console.log(reload);
// if (loading.value || allLoaded.value) return; // Останавливаем загрузку, если уже загружается или данные загружены полностью
loading.value = true;
try {
console.log(reload);
const response = await getTransactions('INSTANT', null, null, selectedUserId.value ? selectedUserId.value : null, null, reload ? offset.value : limit, reload ? 0 : offset.value);
const newTransactions = response.data;
@@ -39,7 +38,7 @@ const fetchTransactions = async (reload) => {
// Добавляем новые транзакции к текущему списку
reload ? transactions.value = newTransactions : transactions.value.push(...newTransactions)
offset.value += limit; // Обновляем смещение для следующей загрузки
!reload ? offset.value += limit : offset.value
} catch (error) {
console.error("Error fetching transactions:", error);
}
@@ -110,7 +109,7 @@ const fetchUsers = async () => {
const selectedTransactionType = ref(null)
const types = ref([])
onMounted(async () => {
EventBus.on('transactions-updated', fetchTransactions);
EventBus.on('transactions-updated', fetchTransactions,true);
await fetchTransactions(); // Первоначальная загрузка данных
await fetchUsers();
await getTransactionTypes().then( it => types.value = it.data);