import { IBaseResponse } from '@/@core/types/api'
import { useCustomMutation } from '@/hooks/api'
import { request } from '@/utils'

export const UPDATE_SECTION_QUERY_KEY = 'update-section'

export const useUpdateSection = (sectionId: string) => {
  const updateMutation = useCustomMutation<any, IBaseResponse<any>>([UPDATE_SECTION_QUERY_KEY, sectionId], data => {
    return request<IBaseResponse<any>, any>({
      url: `dashboard/sections/${sectionId}`,
      method: 'PUT',
      data
    })
  })
  return updateMutation
}
