nuxt-custom-fetch 0.0.1 → 1.0.0
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/README.md +0 -5
- package/dist/module.json +1 -1
- package/dist/runtime/ajax.d.ts +0 -1
- package/dist/runtime/ajax.mjs +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
baseURL?: string
|
|
11
|
-
useHandler?: boolean
|
|
12
11
|
paramsHandler?: (params: FetchOptions['params']) => FetchOptions & HTTPConfig
|
|
13
12
|
extraParams?: string[]
|
|
14
13
|
offline?: () => void
|
|
@@ -18,10 +17,6 @@ offline?: () => void
|
|
|
18
17
|
|
|
19
18
|
当前实例下的 baseURL
|
|
20
19
|
|
|
21
|
-
### useHandler
|
|
22
|
-
|
|
23
|
-
是否使用 paramsHandler
|
|
24
|
-
|
|
25
20
|
### paramsHandler
|
|
26
21
|
|
|
27
22
|
处理 params 的自定义函数
|
package/dist/module.json
CHANGED
package/dist/runtime/ajax.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export declare const ajax: <DataT, ErrorT = Error | null>(url: string, key: stri
|
|
|
6
6
|
}) => Promise<_AsyncData<DataT, ErrorT>>;
|
|
7
7
|
type HTTPConfig = {
|
|
8
8
|
baseURL?: string;
|
|
9
|
-
useHandler?: boolean;
|
|
10
9
|
extraParams?: string[];
|
|
11
10
|
paramsHandler?: (params: FetchOptions['params']) => FetchOptions & HTTPConfig;
|
|
12
11
|
offline?: () => void;
|
package/dist/runtime/ajax.mjs
CHANGED
|
@@ -56,7 +56,6 @@ export class HTTP {
|
|
|
56
56
|
constructor(config = { baseURL: "" }) {
|
|
57
57
|
this.params = {};
|
|
58
58
|
this.params = {
|
|
59
|
-
useHandler: true,
|
|
60
59
|
...config
|
|
61
60
|
};
|
|
62
61
|
}
|
|
@@ -70,7 +69,7 @@ export class HTTP {
|
|
|
70
69
|
}
|
|
71
70
|
get(url, config = {}) {
|
|
72
71
|
const key = getKey(url, config.params, this.params.extraParams);
|
|
73
|
-
const params = this.
|
|
72
|
+
const params = this.baseConfig(config);
|
|
74
73
|
return ajax(url, key, {
|
|
75
74
|
baseURL: this.params.baseURL,
|
|
76
75
|
method: "GET",
|
|
@@ -80,7 +79,7 @@ export class HTTP {
|
|
|
80
79
|
}
|
|
81
80
|
post(url, config = {}) {
|
|
82
81
|
const key = getKey(url, config.params, this.params.extraParams);
|
|
83
|
-
const params = this.
|
|
82
|
+
const params = this.baseConfig(config);
|
|
84
83
|
return ajax(url, key, {
|
|
85
84
|
baseURL: this.params.baseURL,
|
|
86
85
|
method: "POST",
|