@ks-web/use 0.0.8 → 0.0.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.
|
@@ -52,15 +52,15 @@ export declare function handleOptions(httpInstance: HttpClient, url: string, met
|
|
|
52
52
|
formSerializer?: import("axios").FormSerializerOptions | undefined;
|
|
53
53
|
userConfig: {
|
|
54
54
|
baseURL?: string | undefined;
|
|
55
|
-
headers?: Record<string, any> | undefined;
|
|
55
|
+
headers?: Record<string, any> | (Record<string, any> & import("axios").AxiosHeaders) | undefined;
|
|
56
56
|
cancelToken?: CancelToken | import("axios").CancelTokenSource | undefined;
|
|
57
57
|
ksAdapter?: boolean | undefined;
|
|
58
58
|
failToast?: boolean | undefined;
|
|
59
59
|
loading?: boolean | undefined;
|
|
60
60
|
tips?: boolean | undefined;
|
|
61
61
|
customHeaders?: boolean | undefined;
|
|
62
|
-
onUploadProgress?: ((progressEvent:
|
|
63
|
-
onDownloadProgress?: ((progressEvent:
|
|
62
|
+
onUploadProgress?: ((progressEvent: import("axios").AxiosProgressEvent) => void) | undefined;
|
|
63
|
+
onDownloadProgress?: ((progressEvent: import("axios").AxiosProgressEvent) => void) | undefined;
|
|
64
64
|
options?: Record<string, any> | undefined;
|
|
65
65
|
origin?: boolean | undefined;
|
|
66
66
|
appKey?: string | number | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AxiosRequestTransformer, AxiosResponseTransformer, AxiosAdapter, AxiosRequestConfig, AxiosInstance, CancelToken, CancelTokenSource, Canceler, AxiosResponse } from 'axios';
|
|
2
|
-
export interface HttpOptions {
|
|
1
|
+
import type { AxiosRequestTransformer, AxiosResponseTransformer, AxiosAdapter, AxiosRequestConfig, AxiosInstance, CancelToken, CancelTokenSource, Canceler, AxiosResponse, AxiosProgressEvent, AxiosHeaders } from 'axios';
|
|
2
|
+
export interface HttpOptions<D = any> {
|
|
3
3
|
baseURL?: string;
|
|
4
|
-
headers?: Record<string,
|
|
4
|
+
headers?: AxiosHeaders | Record<string, D>;
|
|
5
5
|
timeout?: number;
|
|
6
6
|
adapter?: AxiosAdapter;
|
|
7
7
|
transformRequest?: AxiosRequestTransformer;
|
|
@@ -17,18 +17,18 @@ export interface HttpOptions {
|
|
|
17
17
|
casToken?: boolean;
|
|
18
18
|
appKey?: string | number;
|
|
19
19
|
}
|
|
20
|
-
export interface RequestOptions {
|
|
20
|
+
export interface RequestOptions<D = any> {
|
|
21
21
|
baseURL?: string;
|
|
22
|
-
headers?: Record<string,
|
|
22
|
+
headers?: Record<string, D>;
|
|
23
23
|
cancelToken?: CancelToken | CancelTokenSource;
|
|
24
24
|
ksAdapter?: boolean;
|
|
25
25
|
failToast?: boolean;
|
|
26
26
|
loading?: boolean;
|
|
27
27
|
tips?: boolean;
|
|
28
28
|
customHeaders?: boolean;
|
|
29
|
-
onUploadProgress?: (progressEvent:
|
|
30
|
-
onDownloadProgress?: (progressEvent:
|
|
31
|
-
options?: Record<string,
|
|
29
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
|
30
|
+
onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
|
31
|
+
options?: Record<string, D>;
|
|
32
32
|
origin?: boolean;
|
|
33
33
|
appKey?: string | number;
|
|
34
34
|
}
|
package/dist/useHttp/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import type { RequestOptions } from './http/types';
|
|
|
2
2
|
export declare function useHttp(): {
|
|
3
3
|
cancel: (message: string) => void;
|
|
4
4
|
createCancelToken: () => import("./http/types").CancelTokenMap;
|
|
5
|
-
$get: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
6
|
-
$put: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
7
|
-
$del: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
8
|
-
$patch: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
9
|
-
$post: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
10
|
-
$http: (url: string, appKey: string | number, data: any, config?: RequestOptions | undefined) => Promise<any>;
|
|
5
|
+
$get: (url: string, appKey: string | number, data: any, config?: RequestOptions<any> | undefined) => Promise<any>;
|
|
6
|
+
$put: (url: string, appKey: string | number, data: any, config?: RequestOptions<any> | undefined) => Promise<any>;
|
|
7
|
+
$del: (url: string, appKey: string | number, data: any, config?: RequestOptions<any> | undefined) => Promise<any>;
|
|
8
|
+
$patch: (url: string, appKey: string | number, data: any, config?: RequestOptions<any> | undefined) => Promise<any>;
|
|
9
|
+
$post: (url: string, appKey: string | number, data: any, config?: RequestOptions<any> | undefined) => Promise<any>;
|
|
10
|
+
$http: (url: string, appKey: string | number, data: any, config?: RequestOptions<any> | undefined) => Promise<any>;
|
|
11
11
|
};
|