initial: bootstrap from BukidBountyApp base
This commit is contained in:
29
resources/js/composables/useGlobalTransactions.js
Normal file
29
resources/js/composables/useGlobalTransactions.js
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user