@yeepay/client-utils 2.0.3 → 2.2.0
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 +0 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -5
- package/dist/index.mjs +10 -5
- package/package.json +10 -12
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -112,7 +112,8 @@ function serviceFactory(options, ...callbacks) {
|
|
|
112
112
|
timeout = 12e5,
|
|
113
113
|
// 默认 2 分钟
|
|
114
114
|
headers,
|
|
115
|
-
code
|
|
115
|
+
code,
|
|
116
|
+
debug
|
|
116
117
|
} = options;
|
|
117
118
|
const {
|
|
118
119
|
successCallback = (_response) => ({}),
|
|
@@ -141,10 +142,12 @@ function serviceFactory(options, ...callbacks) {
|
|
|
141
142
|
config.headers.Authorization = getToken();
|
|
142
143
|
const { method, url = "" } = config;
|
|
143
144
|
if (method === "get") {
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
if (!debug) {
|
|
146
|
+
if (url.includes("?"))
|
|
147
|
+
config.url = `${url}&_t=${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
148
|
+
else
|
|
149
|
+
config.url = `${url}?_t=${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
150
|
+
}
|
|
148
151
|
}
|
|
149
152
|
return config;
|
|
150
153
|
},
|
|
@@ -172,6 +175,8 @@ function serviceFactory(options, ...callbacks) {
|
|
|
172
175
|
}
|
|
173
176
|
},
|
|
174
177
|
(error) => {
|
|
178
|
+
if (import_axios.default.isCancel(error))
|
|
179
|
+
return Promise.reject(error);
|
|
175
180
|
let status = 0;
|
|
176
181
|
try {
|
|
177
182
|
status = error.response.status || error.response.data.status;
|
package/dist/index.mjs
CHANGED
|
@@ -72,7 +72,8 @@ function serviceFactory(options, ...callbacks) {
|
|
|
72
72
|
timeout = 12e5,
|
|
73
73
|
// 默认 2 分钟
|
|
74
74
|
headers,
|
|
75
|
-
code
|
|
75
|
+
code,
|
|
76
|
+
debug
|
|
76
77
|
} = options;
|
|
77
78
|
const {
|
|
78
79
|
successCallback = (_response) => ({}),
|
|
@@ -101,10 +102,12 @@ function serviceFactory(options, ...callbacks) {
|
|
|
101
102
|
config.headers.Authorization = getToken();
|
|
102
103
|
const { method, url = "" } = config;
|
|
103
104
|
if (method === "get") {
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
if (!debug) {
|
|
106
|
+
if (url.includes("?"))
|
|
107
|
+
config.url = `${url}&_t=${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
108
|
+
else
|
|
109
|
+
config.url = `${url}?_t=${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
110
|
+
}
|
|
108
111
|
}
|
|
109
112
|
return config;
|
|
110
113
|
},
|
|
@@ -132,6 +135,8 @@ function serviceFactory(options, ...callbacks) {
|
|
|
132
135
|
}
|
|
133
136
|
},
|
|
134
137
|
(error) => {
|
|
138
|
+
if (axios.isCancel(error))
|
|
139
|
+
return Promise.reject(error);
|
|
135
140
|
let status = 0;
|
|
136
141
|
try {
|
|
137
142
|
status = error.response.status || error.response.data.status;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yeepay/client-utils",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "shared utilities for yeepay client packages",
|
|
5
5
|
"author": "Angus Yang",
|
|
6
6
|
"homepage": "http://gitlab.yeepay.com/ued/client-utils#readme",
|
|
@@ -20,24 +20,22 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@imyangyong/utils": "^0.
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"graphql": "^16.8.1",
|
|
27
|
-
"js-cookie": "^3.0.5",
|
|
28
|
-
"unfetch": "^5.0.0"
|
|
23
|
+
"@imyangyong/utils": "^0.8.0",
|
|
24
|
+
"axios": "^1.7.0",
|
|
25
|
+
"js-cookie": "^3.0.5"
|
|
29
26
|
},
|
|
30
27
|
"devDependencies": {
|
|
31
28
|
"@antfu/ni": "^0.21.12",
|
|
32
29
|
"@types/js-cookie": "^3.0.6",
|
|
33
|
-
"@yeepay/eslint-config": "^1.
|
|
34
|
-
"bumpp": "^9.4.
|
|
35
|
-
"eslint
|
|
30
|
+
"@yeepay/eslint-config": "^1.7.0",
|
|
31
|
+
"bumpp": "^9.4.1",
|
|
32
|
+
"eslint": "^9.3.0",
|
|
33
|
+
"eslint-plugin-format": "^0.1.1",
|
|
36
34
|
"lint-staged": "^15.2.2",
|
|
37
35
|
"simple-git-hooks": "^2.11.1",
|
|
38
36
|
"tsup": "^8.0.2",
|
|
39
|
-
"typescript": "^5.4.
|
|
40
|
-
"vitest": "^1.
|
|
37
|
+
"typescript": "^5.4.5",
|
|
38
|
+
"vitest": "^1.6.0"
|
|
41
39
|
},
|
|
42
40
|
"simple-git-hooks": {
|
|
43
41
|
"pre-commit": "pnpm lint-staged"
|