nuxt-custom-fetch 1.1.4 → 1.1.6
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 +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/ajax.d.ts +1 -1
- package/dist/runtime/ajax.mjs +2 -0
- package/dist/runtime/type.d.ts +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
```ts
|
|
10
10
|
{
|
|
11
11
|
baseURL?: string
|
|
12
|
-
paramsHandler?: (params:
|
|
12
|
+
paramsHandler?: (params: Record<string, any>) => Record<string, any>
|
|
13
13
|
offline?: () => void
|
|
14
14
|
}
|
|
15
15
|
```
|
|
@@ -136,7 +136,7 @@ const ajax = new CustomFetch({
|
|
|
136
136
|
}
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
-
export const getInfo = (params:
|
|
139
|
+
export const getInfo = (params: Record<string, any>) =>
|
|
140
140
|
ajax.get<DataT>('/api/get-ip', { params }, options?: AsyncDataOptions<DataT>)
|
|
141
141
|
```
|
|
142
142
|
|
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,6 +99,8 @@ 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 };
|
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<string, any>) => Record<string, any>;
|
|
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.6",
|
|
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
|
}
|