uniapp-request-sdk 1.0.2 → 1.0.3
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.
- package/dist/index.d.ts +8 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
interface IParams {
|
|
4
4
|
/** baseUrl,代理的path也需要填入,比如https://hostname/proxy/ */
|
|
5
|
-
baseUrl
|
|
5
|
+
baseUrl?: string;
|
|
6
6
|
/** 公共错误处理函数 */
|
|
7
7
|
onErrorHandler?: (error: any) => void;
|
|
8
8
|
/** 公共请求头 */
|
|
@@ -14,7 +14,7 @@ interface IParams {
|
|
|
14
14
|
/** 请求尝试延迟时间 */
|
|
15
15
|
retryDelay?: number;
|
|
16
16
|
/** token */
|
|
17
|
-
token
|
|
17
|
+
token?: string;
|
|
18
18
|
/** 向APP得到token的event事件名称,默认getToken */
|
|
19
19
|
tokenEventName?: string;
|
|
20
20
|
}
|
|
@@ -34,12 +34,12 @@ declare class UniRequest {
|
|
|
34
34
|
constructor(params?: IParams);
|
|
35
35
|
private rejectHandler;
|
|
36
36
|
setParams(params?: IParams): void;
|
|
37
|
-
request(params: {
|
|
37
|
+
request<T>(params: {
|
|
38
38
|
url: string;
|
|
39
39
|
method: RequestOptions['method'];
|
|
40
40
|
data?: RequestOptions['data'];
|
|
41
41
|
header?: RequestOptions['header'];
|
|
42
|
-
} & RequestOptions): Promise<
|
|
42
|
+
} & RequestOptions): Promise<T>;
|
|
43
43
|
/**
|
|
44
44
|
* post请求
|
|
45
45
|
* @param url
|
|
@@ -47,10 +47,10 @@ declare class UniRequest {
|
|
|
47
47
|
* @param header
|
|
48
48
|
* @returns
|
|
49
49
|
*/
|
|
50
|
-
post(url: string, data?: {}, header?: Record<string, string>): Promise<
|
|
51
|
-
get(url: string, data?: {}, header?: Record<string, string>): Promise<
|
|
52
|
-
delete(url: string, data?: {}, header?: Record<string, string>): Promise<
|
|
53
|
-
put(url: string, data?: {}, header?: Record<string, string>): Promise<
|
|
50
|
+
post<T>(url: string, data?: {}, header?: Record<string, string>): Promise<T>;
|
|
51
|
+
get<T>(url: string, data?: {}, header?: Record<string, string>): Promise<T>;
|
|
52
|
+
delete<T>(url: string, data?: {}, header?: Record<string, string>): Promise<T>;
|
|
53
|
+
put<T>(url: string, data?: {}, header?: Record<string, string>): Promise<T>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export { IParams, UniRequest as default };
|