import { defineStore } from 'pinia'
import { ref } from 'vue'
import { applyBindInfoListApi } from '@/api'
import type { BindApplyItemType } from '@/pages/mine/interface'

export const bindApplyStore = defineStore('bindApplyStore', () => {
  const bindApplyList = ref<BindApplyItemType[]>()
  const applyBindMsg = ref(false)
  // 未处理的绑定申请列表
  const getApplyBindInfoList = async () => {
    try {
      const data = await applyBindInfoListApi()
      bindApplyList.value = data
      applyBindMsg.value = data?.length
      return data
    } catch (err) {
      console.log(err)
    }
  }
  return {
    applyBindMsg,
    bindApplyList,
    getApplyBindInfoList,
  }
})
