import type { AxiosError, Method } from "axios"; import type { UseMutationResult, DefaultError } from "@tanstack/react-query"; import type { FlexibleConciergeConfig } from "../../../types/concierge"; import type { FunctionlessUseMutationOptions } from "../../../types/tanstack-query"; import type { DatalessAxiosRequestConfig, ServerData, Methodless } from "../../../types/axios"; /** Forces the `DELETE` request to not have a payload. */ export type UseDestroyPayload = void; /** Extracts the selected methos from Axios. */ export type UseDestroyMethod = Extract; /** * Represents the error speficically raised by Axios. * * @template E The error. */ export type UseDestroyHTTPError = AxiosError; /** * Represents the exception raised by `mutationFn` - either a standard error or * an Axios error. * * @template E The error. */ export type UseDestroyException = DefaultError | UseDestroyHTTPError; /** * `useDestroy` hook configuration. Offers `useMutation`, Axios and concierge * configurations separately. * * @template R The response. * @template P The URL parameters. * @template E The error. */ export interface UseDestroyOptions extends FlexibleConciergeConfig { /** `useMutation` configuration without `mutationFn`. */ reactQuery: FunctionlessUseMutationOptions, UseDestroyPayload, UseDestroyException>; /** Axios configuration with no data and method. */ axios?: Methodless>; } /** * `useDestroy` hook result. fromServeres TanStack Query's `useMutation` result. * @template R The response. * @template E The error. */ export type UseDestroyResult = UseMutationResult, UseDestroyException, UseDestroyPayload>;