import { defineStore } from 'pinia'
import { getInterviewOptions } from '@/api'
import type { InterviewOptionDto } from '@/api/article/types'
import { createCachedFetcher } from './helpers'
/**
 * 关于专访的相关数据 --不分页
 */
export const useInterviewStore = defineStore('interview', () => {
  const interviewList = ref<InterviewOptionDto[]>([])

  const fetchInterviewList = createCachedFetcher(
    getInterviewOptions,
    (data) => {
      interviewList.value = data
    },
    { skipIfLoaded: () => interviewList.value.length > 0 },
  )
  fetchInterviewList()

  return { interviewList, fetchInterviewList }
})
