import { ShallowRef, Ref } from 'vue-demi'; import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios'; interface UseAxiosReturn, _D = any> { /** * Axios Response */ response: ShallowRef; /** * Axios response data */ data: Ref; /** * Indicates if the request has finished */ isFinished: Ref; /** * Indicates if the request is currently loading */ isLoading: Ref; /** * Indicates if the request was canceled */ isAborted: Ref; /** * Any errors that may have occurred */ error: ShallowRef; /** * Aborts the current request */ abort: (message?: string | undefined) => void; /** * Alias to `abort` */ cancel: (message?: string | undefined) => void; /** * Alias to `isAborted` */ isCanceled: Ref; } interface StrictUseAxiosReturn extends UseAxiosReturn { /** * Manually call the axios request */ execute: (url?: string | AxiosRequestConfig, config?: AxiosRequestConfig) => Promise>; } interface EasyUseAxiosReturn extends UseAxiosReturn { /** * Manually call the axios request */ execute: (url: string, config?: AxiosRequestConfig) => Promise>; } interface UseAxiosOptions { /** * Will automatically run axios request when `useAxios` is used * */ immediate?: boolean; /** * Use shallowRef. * * @default true */ shallow?: boolean; /** * Abort previous request when a new request is made. * * @default true */ abortPrevious?: boolean; /** * Callback when error is caught. */ onError?: (e: unknown) => void; /** * Callback when success is caught. */ onSuccess?: (data: T) => void; /** * Initial data to use */ initialData?: T; /** * Sets the state to initialState before executing the promise. */ resetOnExecute?: boolean; /** * Callback when request is finished. */ onFinish?: () => void; } declare function useAxios, D = any>(url: string, config?: AxiosRequestConfig, options?: UseAxiosOptions): StrictUseAxiosReturn & Promise>; declare function useAxios, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn & Promise>; declare function useAxios, D = any>(url: string, config: AxiosRequestConfig, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn & Promise>; declare function useAxios, D = any>(config?: AxiosRequestConfig): EasyUseAxiosReturn & Promise>; declare function useAxios, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn & Promise>; declare function useAxios, D = any>(config?: AxiosRequestConfig, instance?: AxiosInstance): EasyUseAxiosReturn & Promise>; export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };