'use client'

import { useCustomQuery } from '@/hooks/api'
import { IBaseResponse } from '@/@core/types/api'
import { request } from '@/utils'
import { ICategory } from '@/types/data/categories/category.interface'

export const useGetCategoryInfo = (categoryId?: string) => {
  return useCustomQuery<IBaseResponse<ICategory>>(
    ['category-info', categoryId],
    () => request({ url: `/categories/${categoryId}` }),
    { enabled: !!categoryId }
  )
}
