19 lines
469 B
TypeScript
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 }
|
|
})
|