nuxt-custom-fetch 1.0.4 → 1.0.6-alpha.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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "nuxt-http-fetch",
3
3
  "configKey": "httpFetch",
4
- "version": "1.0.4"
4
+ "version": "1.0.6-alpha.0"
5
5
  }
@@ -7,6 +7,7 @@ export declare class HTTP {
7
7
  interceptors: Interceptors;
8
8
  constructor(config?: HTTPConfig);
9
9
  private baseConfig;
10
- get<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): Promise<_AsyncData<DataT, ErrorT>>;
11
- post<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): Promise<_AsyncData<DataT, ErrorT>>;
10
+ http<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): Promise<_AsyncData<DataT, ErrorT>>;
11
+ get<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): void;
12
+ post<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): void;
12
13
  }
@@ -76,28 +76,21 @@ export class HTTP {
76
76
  }
77
77
  return { ...params };
78
78
  }
79
- get(url, config = {}, options) {
79
+ http(url, config = {}, options) {
80
80
  const key = getKey(url, config, this.params.extraParams);
81
81
  const query = this.baseConfig(config);
82
82
  return ajax(url, key, {
83
83
  baseURL: this.params.baseURL,
84
- method: "GET",
85
84
  ...config,
86
85
  query,
87
86
  interceptors: this.interceptors,
88
87
  offline: this.params.offline
89
88
  }, options);
90
89
  }
90
+ get(url, config = {}, options) {
91
+ this.http(url, { method: "GET", ...config }, options);
92
+ }
91
93
  post(url, config = {}, options) {
92
- const key = getKey(url, config, this.params.extraParams);
93
- const query = this.baseConfig(config);
94
- return ajax(url, key, {
95
- baseURL: this.params.baseURL,
96
- method: "POST",
97
- ...config,
98
- query,
99
- interceptors: this.interceptors,
100
- offline: this.params.offline
101
- }, options);
94
+ this.http(url, { method: "POST", ...config }, options);
102
95
  }
103
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-custom-fetch",
3
- "version": "1.0.4",
3
+ "version": "1.0.6-alpha.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {