import { ShallowRef, Ref } from 'vue-demi'; import { AxiosResponse, AxiosError, RawAxiosRequestConfig, 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 | undefined>; /** * Aborts the current request */ abort: (message?: string | undefined) => void; /** * isFinished alias * @deprecated use `isFinished` instead */ finished: Ref; /** * isLoading alias * @deprecated use `isLoading` instead */ loading: Ref; /** * isAborted alias * @deprecated use `isAborted` instead */ aborted: Ref; /** * abort alias */ cancel: (message?: string | undefined) => void; /** * isAborted alias * @deprecated use `isCanceled` instead */ canceled: Ref; /** * isAborted alias */ isCanceled: Ref; } interface StrictUseAxiosReturn extends UseAxiosReturn { /** * Manually call the axios request */ execute: (url?: string | RawAxiosRequestConfig, config?: RawAxiosRequestConfig) => PromiseLike>; } interface EasyUseAxiosReturn extends UseAxiosReturn { /** * Manually call the axios request */ execute: (url: string, config?: RawAxiosRequestConfig) => PromiseLike>; } interface UseAxiosOptions { /** * Will automatically run axios request when `useAxios` is used * */ immediate?: boolean; /** * Use shallowRef. * * @default true */ shallow?: boolean; /** * Callback when error is caught. */ onError?: (e: unknown) => void; /** * Callback when success is caught. */ onSuccess?: (data: T) => void; } declare function useAxios, D = any>(url: string, config?: RawAxiosRequestConfig, options?: UseAxiosOptions): StrictUseAxiosReturn & PromiseLike>; declare function useAxios, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn & PromiseLike>; declare function useAxios, D = any>(url: string, config: RawAxiosRequestConfig, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn & PromiseLike>; declare function useAxios, D = any>(config?: RawAxiosRequestConfig): EasyUseAxiosReturn & PromiseLike>; declare function useAxios, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn & PromiseLike>; declare function useAxios, D = any>(config?: RawAxiosRequestConfig, instance?: AxiosInstance): EasyUseAxiosReturn & PromiseLike>; export { EasyUseAxiosReturn, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, useAxios };