diff --git a/packages/fes-plugin-request/types.d.ts b/packages/fes-plugin-request/types.d.ts index 1d3c2526..d7bb4176 100644 --- a/packages/fes-plugin-request/types.d.ts +++ b/packages/fes-plugin-request/types.d.ts @@ -7,14 +7,16 @@ type ResponseInterceptor = (value: AxiosResponse) => AxiosResponse | [(value: Ax interface RequestPluginOption { mergeRequest?: boolean; + dataHandler?(data: any, response: AxiosResponse): any; + errorHandler?(error: AxiosError | {type: string, msg: string, [key: string]: string}): void; cache?: boolean | { type: 'ram' | 'sessionStorage' | 'localStorage', cacheTime: number; } } -export function request(url: string, data: null | Record, options: AxiosRequestConfig & RequestPluginOption ): Promise -export function useRequest(url: string, data: null | Record, options: AxiosRequestConfig & RequestPluginOption ): {loadingRef: Ref; errorRef: Ref; dataRef: Ref} +export function request(url: string, data?: null | Record, options?: AxiosRequestConfig & RequestPluginOption ): Promise +export function useRequest(url: string, data?: null | Record, options?: AxiosRequestConfig & RequestPluginOption ): {loadingRef: Ref; errorRef: Ref; dataRef: Ref} declare module "@fesjs/fes" { interface PluginRuntimeConfig { request?: {