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 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
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "nuxt-http-fetch",
3
3
  "configKey": "httpFetch",
4
- "version": "0.0.1"
4
+ "version": "1.0.0"
5
5
  }
@@ -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;
@@ -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.params.useHandler ? this.baseConfig(config) : config.params;
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.params.useHandler ? this.baseConfig(config) : config.params;
82
+ const params = this.baseConfig(config);
84
83
  return ajax(url, key, {
85
84
  baseURL: this.params.baseURL,
86
85
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-custom-fetch",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {