UNPKG

alloy-request

Version:

alloy-request 基于`axios`和`ahooks的useRequest`封装的 react 请求库

17 lines (16 loc) 826 B
import type { AxiosRequestConfig } from 'axios'; import type { Options, Result } from 'ahooks/lib/useRequest/src/types'; declare type TypeAxiosRequestConfigService = AxiosRequestConfig&{ payload?: Record<string, any>; }; declare type TypeCombineService<V extends any[] = any> = (...argv: V) => TypeAxiosRequestConfigService; declare type TypeAipResponse = { code?: number; data?: any; [key: string]: any; }; declare function useAxios<P extends any[] = any, U = any, UU extends U = any>(url: string, service?: TypeCombineService<P>, options?: Options<UU, P> & { formatResult: (res: TypeAipResponse) => U; }): Result<U, P>; declare function useAxios<P extends any[] = any>(url: string, service?: TypeCombineService<P>, options?: Options<TypeAipResponse, P>): Result<TypeAipResponse, P>; export { useAxios };