import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getEnum } from '@/api/common'

export const useDictStore = defineStore(
  'dict',
  () => {
    const dict = ref<any>({})

    async function getDict(id: string) {
      const res = await getEnum({ id })
      dict.value = res.data
    }
    return {
      dict,
      getDict,
    }
  },
  {
    persist: true,
  },
)
