Files
boursecu_user/src/views/base/home/composables/useUserFunds.ts
T

22 lines
591 B
TypeScript

import { ref } from 'vue'
import { useFundUserStore } from '@/store/fundStore'
export function useUserFunds() {
const funds = ref([])
const loading = ref(false)
const fundStore = useFundUserStore()
const loadFunds = async () => {
try {
loading.value = true
const result = await fundStore.getMyFund()
funds.value = result?.rows || []
} catch (error) {
console.error('Error loading funds:', error)
} finally {
loading.value = false
}
}
return { funds, loading, loadFunds }
}