import { defineStore } from 'pinia'
import { getYaBiData } from '@/api'
import type { YaBiData } from '@/api'
import { createCachedFetcher } from './helpers'
/**
 * 关于用户ya币的store
 */
export const useYaBiStore = defineStore('yabi', () => {
  // 用户ya币数据
  const yabiData = ref({} as YaBiData)

  const fetchYaBiData = createCachedFetcher(getYaBiData, (data) => {
    yabiData.value = data
  })
  // 手动调用一次
  fetchYaBiData()

  return { yabiData, fetchYaBiData }
})
