import { IBaseResponse } from '@/@core/types/api'
import { useCustomMutation } from '@/hooks/api'
import { request } from '@/utils'
import { IChangePassword } from '@/types/data/change-password.interface'

export const CHANGE_PASSWORD_QUERY_KEY = 'change-password'

export const useChangePassword = () => {
  const changePasswordMutation = useCustomMutation<IChangePassword, IBaseResponse<any>>(
    [CHANGE_PASSWORD_QUERY_KEY],
    data => {
      return request<IBaseResponse<any>, IChangePassword>({
        url: `dashboard/profile/changePassword`,
        method: 'POST',
        data
      })
    }
  )
  return changePasswordMutation
}
