nuxt-custom-fetch 4.0.0-alpha.11 → 4.0.0-alpha.12

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.
@@ -49,13 +49,22 @@ export class CustomFetch {
49
49
  Object.assign(config, this.baseConfig(config));
50
50
  const generateOptionSegmentsWithConfig = generateOptionSegments(config);
51
51
  if (this.showLogs && import.meta.client) {
52
+ const { body: _body, ...resetConfig } = config;
52
53
  let bodyLogs;
53
54
  try {
54
- bodyLogs = serialize(config.body);
55
+ bodyLogs = serialize(_body);
55
56
  } catch (error) {
56
- console.warn("[Custom Fetch] couldn't serialize `Body:`", error);
57
+ console.warn("[Custom Fetch] couldn't serialize [Body]:", error);
57
58
  }
58
- console.warn("[Custom Fetch] `Request:`", url, "`Query:`", serialize(generateOptionSegmentsWithConfig), " `Body:`", bodyLogs);
59
+ console.warn([
60
+ "\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 [Custom Fetch] \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014",
61
+ `[Request URL]: ${url}`,
62
+ "",
63
+ `[Query]: ${serialize(resetConfig)}`,
64
+ "",
65
+ `[Body]: ${bodyLogs}`,
66
+ "\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014"
67
+ ].join("\n"));
59
68
  }
60
69
  const { onRequest, onRequestError, onResponse, onResponseError, offline, handler, useHandler, showLogs, immutableKey, ...asyncDataOptions } = config;
61
70
  if (import.meta.client && navigator && !navigator.onLine) {
@@ -81,12 +90,6 @@ export class CustomFetch {
81
90
  fns?.(ctx);
82
91
  }
83
92
  });
84
- throw createError({
85
- statusCode: 400,
86
- statusMessage: ctx.error.message,
87
- message: ctx.error.message,
88
- fatal: true
89
- });
90
93
  },
91
94
  onResponse(ctx) {
92
95
  [interceptors.onResponse, onResponse].forEach((fns) => {
@@ -105,12 +108,6 @@ export class CustomFetch {
105
108
  fns?.(ctx);
106
109
  }
107
110
  });
108
- throw createError({
109
- statusCode: 500,
110
- statusMessage: ctx.request.toString(),
111
- message: ctx.response._data,
112
- fatal: true
113
- });
114
111
  }
115
112
  };
116
113
  const hashValue = ["custom_fetch:", url];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-custom-fetch",
3
3
  "type": "module",
4
- "version": "4.0.0-alpha.11",
4
+ "version": "4.0.0-alpha.12",
5
5
  "packageManager": "pnpm@8.15.3+sha1.64838798f519c18029c1e8a1310e16101fc2eda0",
6
6
  "license": "MIT",
7
7
  "repository": {