import { defineStore } from 'pinia'
import { getColumnOptions } from '@/api'
import type { ColumnOptionDto } from '@/api/article/types'
import { createCachedFetcher } from './helpers'

/**
 * 关于专栏的不分页数据
 */
export const useColumnStore = defineStore('column', () => {
  const columnList = ref<ColumnOptionDto[]>([])

  const fetchColumnList = createCachedFetcher(getColumnOptions, (data) => {
    columnList.value = data
  })
  fetchColumnList()
  return { columnList, fetchColumnList }
})
