nuxt-custom-fetch 1.1.4 → 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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "nuxt-custom-fetch",
3
3
  "configKey": "customFetch",
4
- "version": "1.1.4"
4
+ "version": "1.1.5"
5
5
  }
@@ -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, DataT, import("nuxt/app").KeysOf<DataT>, null> | undefined) => AsyncData<PickFrom<DataT, KeysOf<DataT>> | null, (ErrorT extends Error | NuxtError<unknown> ? ErrorT : NuxtError<ErrorT>) | null>;
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;
@@ -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 };
@@ -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: FetchOptions['params']) => HTTPConfig;
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.4",
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 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.10.2",
29
- "typescript": "^5.3.3"
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.10.2",
33
+ "@nuxt/schema": "^3.11.1",
34
34
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
35
- "eslint": "^8.56.0",
36
- "nuxt": "^3.10.2"
35
+ "eslint": "^8.57.0",
36
+ "nuxt": "^3.11.1"
37
37
  }
38
38
  }