rxtutils 1.1.2-beta.7 → 1.1.2-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -98,7 +98,7 @@ interface Options<Params = any, Data = any> {
|
|
|
98
98
|
* 可以配置 HTTP 状态码对应的错误信息或处理函数
|
|
99
99
|
* @default {} 空对象,使用默认处理函数
|
|
100
100
|
*/
|
|
101
|
-
httpErrorCodeMap?: Record<string, string | ((code: number, res: AxiosResponse<Data>, requestParam: RequestOptions<Params>) => ErrorHandlerReturnType<Data> | void)>;
|
|
101
|
+
httpErrorCodeMap?: Record<string, string | ((code: number, res: AxiosResponse<Data>, requestParam: RequestOptions<Params>) => Promise<ErrorHandlerReturnType<Data> | void>)>;
|
|
102
102
|
/**
|
|
103
103
|
* 默认 HTTP 错误码处理函数
|
|
104
104
|
* 当 HTTP 状态码不在 httpErrorCodeMap 中时调用
|
|
@@ -130,7 +130,7 @@ interface RequestOptions<Param> {
|
|
|
130
130
|
* @param baseOptions 基础配置选项
|
|
131
131
|
* @returns 请求创建函数
|
|
132
132
|
*/
|
|
133
|
-
declare function createBaseRequest(baseOptions?: Options): <Param, Data
|
|
133
|
+
declare function createBaseRequest(baseOptions?: Options): <Param, Data extends Record<any, any>>(requestOptions: RequestOptions<Param>, createOptions?: Omit<Options<Param, Data>, "baseURL">) => {
|
|
134
134
|
(requestParam?: Omit<RequestOptions<Param>, "url" | "method">, options?: Omit<Options<Param, Data>, "baseURL" | "cacheDataKey" | "cacheDataInStorage" | "cacheKeyEquals">): Promise<Data>;
|
|
135
135
|
clearCache(): void;
|
|
136
136
|
};
|