import { getQuestionCategory } from '@/api/base'

export function useQuestionList() {
  const list = ref([])
  getQuestionCategory({ project_tag: 'resourse_ci' }).then((res: any) => {
    list.value = res.data?.filter((item: any) => {
      item.children = detailChild(item.children)
      return item.children
    })
  })

  const detailChild = (child: any) => {
    if (!child) return []
    return child?.filter((item: any) => {
      item.children = detailChild(item.children)
      return item.children
    })
  }
  return { list }
}
