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

  const fetchVideoList = createCachedFetcher(
    getVideoOptions,
    (data) => {
      videoList.value = data
    },
    { skipIfLoaded: () => videoList.value.length > 0 },
  )
  fetchVideoList()

  return { videoList, fetchVideoList }
})
