import { computed, onMounted } from 'vue'; import { useGlobalTransactionStore } from '../stores/globalTransaction'; export function useGlobalTransactions(filters = null) { const store = useGlobalTransactionStore(); const transactions = computed(() => store.transactions); const isLoading = computed(() => store.isLoading); const error = computed(() => store.error); const fetchTransactions = async (newFilters = null) => { return await store.fetchTransactions(newFilters || filters || {}); }; const getProductTransactions = (productHash) => { return computed(() => store.getTransactionsByProduct(productHash)); }; const precache = () => store.precache(); return { transactions, isLoading, error, fetchTransactions, getProductTransactions, precache }; }