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

export const UPDATE_SETTINGS_QUERY_KEY = 'update-settings'

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