nuxt-custom-fetch 1.1.3 → 1.1.5
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 -1
- package/dist/runtime/ajax.mjs +3 -1
- package/dist/runtime/type.d.ts +1 -1
- package/package.json +7 -7
package/dist/module.json
CHANGED
package/dist/runtime/ajax.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AsyncData, AsyncDataOptions, NuxtError } from 'nuxt/app';
|
|
2
2
|
import type { HTTPConfig, Interceptors, AjaxConfig, KeysOf, PickFrom } from './type';
|
|
3
|
-
export declare const ajax: <DataT, ErrorT = Error | null>(url: string, key: string, config: AjaxConfig, options?: AsyncDataOptions<DataT
|
|
3
|
+
export declare const ajax: <DataT, ErrorT = Error | null>(url: string, key: string, config: AjaxConfig, options?: AsyncDataOptions<DataT>) => AsyncData<PickFrom<DataT, KeysOf<DataT>> | null, (ErrorT extends Error | NuxtError<unknown> ? ErrorT : NuxtError<ErrorT>) | null>;
|
|
4
4
|
export declare class CustomFetch {
|
|
5
5
|
baseURL: any;
|
|
6
6
|
params: HTTPConfig;
|
package/dist/runtime/ajax.mjs
CHANGED
|
@@ -99,12 +99,14 @@ export class CustomFetch {
|
|
|
99
99
|
const handler = paramsHandler || this.baseParamsHandler;
|
|
100
100
|
const params = (config.query ? config.query : config.params) || {};
|
|
101
101
|
if (useParamsHandler && handler && typeof handler === "function") {
|
|
102
|
+
delete config.params;
|
|
103
|
+
delete config.query;
|
|
102
104
|
return handler({ ...params });
|
|
103
105
|
}
|
|
104
106
|
return { ...params };
|
|
105
107
|
}
|
|
106
108
|
http(url, config = {}, options) {
|
|
107
|
-
const key = config.key ? config.key : hash([...generateOptionSegments(config)]);
|
|
109
|
+
const key = config.key ? config.key : hash([url, ...generateOptionSegments(config)]);
|
|
108
110
|
const baseURL = config?.baseURL || this.baseURL;
|
|
109
111
|
const query = this.baseConfig(config);
|
|
110
112
|
const offline = config?.offline || this.offline;
|
package/dist/runtime/type.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type FetchMethod = 'options' | 'GET' | 'POST' | 'get' | 'HEAD' | 'PATCH'
|
|
|
24
24
|
export interface HTTPConfig extends Omit<FetchOptions, 'method'> {
|
|
25
25
|
baseURL?: string;
|
|
26
26
|
useParamsHandler?: boolean;
|
|
27
|
-
paramsHandler?: (params:
|
|
27
|
+
paramsHandler?: (params: Record<any, string>) => Record<any, string>;
|
|
28
28
|
offline?: () => void;
|
|
29
29
|
method?: FetchMethod;
|
|
30
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-custom-fetch",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
"url": "https://github.com/xjccc/nuxt-custom-fetch.git"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"prepack": "nuxt-module-build
|
|
22
|
+
"prepack": "nuxt-module-build",
|
|
23
23
|
"dev": "nuxi dev playground",
|
|
24
24
|
"dev:build": "nuxi build playground",
|
|
25
25
|
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@nuxt/kit": "^3.
|
|
29
|
-
"typescript": "^5.
|
|
28
|
+
"@nuxt/kit": "^3.11.1",
|
|
29
|
+
"typescript": "^5.4.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@nuxt/module-builder": "^0.5.5",
|
|
33
|
-
"@nuxt/schema": "^3.
|
|
33
|
+
"@nuxt/schema": "^3.11.1",
|
|
34
34
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
35
|
-
"eslint": "^8.
|
|
36
|
-
"nuxt": "^3.
|
|
35
|
+
"eslint": "^8.57.0",
|
|
36
|
+
"nuxt": "^3.11.1"
|
|
37
37
|
}
|
|
38
38
|
}
|