Files
ghatreh_user/src/store/walletStore.ts
T
2026-07-01 22:29:18 +03:30

19 lines
469 B
TypeScript

import { ref } from 'vue'
import {defineStore} from "pinia";
import type {Wallet} from "@/models/wallet";
import {getWallet} from "@/api/wallet";
export const useWalletStore = defineStore('wallet', () => {
const walletInfo = ref<Wallet | undefined>(undefined)
async function getMyWallet() {
try {
walletInfo.value = await getWallet()
return walletInfo.value
} catch (e) {
console.log(e)
}
}
return { walletInfo, getMyWallet }
})