import { ref } from 'vue' import { defineStore } from 'pinia' import { getFundTable } from '@/api/fund' import type { Fund } from '@/models/fund' import type { TableOutput } from '@/models/table' import { getProductInventory } from '@/api/products' export const useFundUserStore = defineStore('fund', () => { /** دارایی‌ها / موجودی محصول (صفحهٔ /fund فعلی) */ const myFunds = ref | undefined>(undefined) /** قلک‌های واقعی (مدل Fund) */ const myPiggyFunds = ref | undefined>(undefined) async function getMyFund() { try { myFunds.value = await getProductInventory() return myFunds.value } catch (e) { console.log(e) } } async function getMyPiggyFunds() { try { myPiggyFunds.value = await getFundTable() return myPiggyFunds.value } catch (e) { console.log(e) } } return { getMyFund, getMyPiggyFunds, myFunds, myPiggyFunds } })