nuxt-custom-fetch 2.3.1 → 2.3.2
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 +1 -0
- package/dist/module.d.mts +2 -1
- package/dist/module.json +2 -2
- package/dist/runtime/ajax.js +24 -40
- package/dist/types.d.mts +3 -1
- package/package.json +5 -5
package/README.md
CHANGED
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/runtime/ajax.js
CHANGED
|
@@ -86,53 +86,37 @@ export class CustomFetch {
|
|
|
86
86
|
const interceptors = this.interceptors;
|
|
87
87
|
const _config = reactive({ ...restAjaxConfig });
|
|
88
88
|
const defaultOptions = {
|
|
89
|
-
onRequest(ctx) {
|
|
90
|
-
[interceptors.onRequest, onRequest].
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
fns?.(ctx);
|
|
89
|
+
async onRequest(ctx) {
|
|
90
|
+
const allFns = [interceptors.onRequest, onRequest].flat();
|
|
91
|
+
for (const fn of allFns) {
|
|
92
|
+
if (fn) {
|
|
93
|
+
await fn(ctx);
|
|
95
94
|
}
|
|
96
|
-
}
|
|
95
|
+
}
|
|
97
96
|
},
|
|
98
|
-
onRequestError(ctx) {
|
|
99
|
-
[interceptors.onRequestError, onRequestError].
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
fns?.(ctx);
|
|
97
|
+
async onRequestError(ctx) {
|
|
98
|
+
const allFns = [interceptors.onRequestError, onRequestError].flat();
|
|
99
|
+
for (const fn of allFns) {
|
|
100
|
+
if (fn) {
|
|
101
|
+
await fn(ctx);
|
|
104
102
|
}
|
|
105
|
-
}
|
|
106
|
-
throw createError({
|
|
107
|
-
statusCode: 400,
|
|
108
|
-
statusMessage: ctx.error.message,
|
|
109
|
-
message: ctx.error.message,
|
|
110
|
-
fatal: true
|
|
111
|
-
});
|
|
103
|
+
}
|
|
112
104
|
},
|
|
113
|
-
onResponse(ctx) {
|
|
114
|
-
[interceptors.onResponse, onResponse].
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
fns?.(ctx);
|
|
105
|
+
async onResponse(ctx) {
|
|
106
|
+
const allFns = [interceptors.onResponse, onResponse].flat();
|
|
107
|
+
for (const fn of allFns) {
|
|
108
|
+
if (fn) {
|
|
109
|
+
await fn(ctx);
|
|
119
110
|
}
|
|
120
|
-
}
|
|
111
|
+
}
|
|
121
112
|
},
|
|
122
|
-
onResponseError(ctx) {
|
|
123
|
-
[interceptors.onResponseError, onResponseError].
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
fns?.(ctx);
|
|
113
|
+
async onResponseError(ctx) {
|
|
114
|
+
const allFns = [interceptors.onResponseError, onResponseError].flat();
|
|
115
|
+
for (const fn of allFns) {
|
|
116
|
+
if (fn) {
|
|
117
|
+
await fn(ctx);
|
|
128
118
|
}
|
|
129
|
-
}
|
|
130
|
-
throw createError({
|
|
131
|
-
statusCode: 500,
|
|
132
|
-
statusMessage: ctx.request.toString(),
|
|
133
|
-
message: ctx.response._data,
|
|
134
|
-
fatal: true
|
|
135
|
-
});
|
|
119
|
+
}
|
|
136
120
|
}
|
|
137
121
|
};
|
|
138
122
|
const hashValue = ["custom_fetch:", url];
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-custom-fetch",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"ohash": "^2.0.11"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@antfu/eslint-config": "^4.
|
|
42
|
+
"@antfu/eslint-config": "^4.12.0",
|
|
43
43
|
"@commitlint/cli": "^19.8.0",
|
|
44
44
|
"@commitlint/config-conventional": "^19.8.0",
|
|
45
|
-
"@nuxt/module-builder": "^1.0.
|
|
45
|
+
"@nuxt/module-builder": "^1.0.1",
|
|
46
46
|
"@nuxt/schema": "^3.16.2",
|
|
47
|
-
"@types/node": "^22.14.
|
|
47
|
+
"@types/node": "^22.14.1",
|
|
48
48
|
"changelogen": "^0.6.1",
|
|
49
49
|
"commitizen": "^4.3.1",
|
|
50
50
|
"cz-git": "^1.11.1",
|
|
51
51
|
"eslint": "^9.24.0",
|
|
52
52
|
"husky": "^9.1.7",
|
|
53
|
-
"lint-staged": "^15.5.
|
|
53
|
+
"lint-staged": "^15.5.1",
|
|
54
54
|
"nitro": "npm:nitropack",
|
|
55
55
|
"nuxt": "^3.16.2",
|
|
56
56
|
"typescript": "5.8.3"
|