nuxt-custom-fetch 1.0.5 → 1.0.6-alpha.1
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 +1 -1
- package/dist/runtime/ajax.d.ts +1 -0
- package/dist/runtime/ajax.mjs +5 -12
- package/package.json +3 -2
package/dist/module.json
CHANGED
package/dist/runtime/ajax.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class HTTP {
|
|
|
7
7
|
interceptors: Interceptors;
|
|
8
8
|
constructor(config?: HTTPConfig);
|
|
9
9
|
private baseConfig;
|
|
10
|
+
http<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): Promise<_AsyncData<DataT, ErrorT>>;
|
|
10
11
|
get<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): Promise<_AsyncData<DataT, ErrorT>>;
|
|
11
12
|
post<DataT, ErrorT = Error | null>(url: string, config?: FetchOptions, options?: AsyncDataOptions<DataT>): Promise<_AsyncData<DataT, ErrorT>>;
|
|
12
13
|
}
|
package/dist/runtime/ajax.mjs
CHANGED
|
@@ -76,28 +76,21 @@ export class HTTP {
|
|
|
76
76
|
}
|
|
77
77
|
return { ...params };
|
|
78
78
|
}
|
|
79
|
-
|
|
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
|
+
return this.http(url, { method: "GET", ...config }, options);
|
|
92
|
+
}
|
|
91
93
|
post(url, config = {}, options) {
|
|
92
|
-
|
|
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
|
+
return 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.
|
|
3
|
+
"version": "1.0.6-alpha.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"url": "https://github.com/xjccc/nuxt-custom-fetch.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@nuxt/kit": "^3.0.0"
|
|
22
|
+
"@nuxt/kit": "^3.0.0",
|
|
23
|
+
"nuxt-custom-fetch": "1.0.6-alpha.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@nuxt/module-builder": "^0.2.1",
|