@lark-apaas/client-toolkit 1.2.1-alpha.15 → 1.2.1-alpha.16
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/lib/index.js +3 -1
- package/lib/utils/axiosConfig.d.ts +1 -1
- package/lib/utils/axiosConfig.js +11 -3
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createClient } from "@lark-apaas/client-capability";
|
|
2
2
|
import { normalizeBasePath } from "./utils/utils.js";
|
|
3
|
+
import { logger } from "./logger/index.js";
|
|
3
4
|
import { version } from "../package.json";
|
|
4
5
|
const capabilityClient = createClient({
|
|
5
6
|
baseURL: normalizeBasePath(process.env.CLIENT_BASE_PATH),
|
|
@@ -7,7 +8,8 @@ const capabilityClient = createClient({
|
|
|
7
8
|
headers: {
|
|
8
9
|
'X-Suda-Csrf-Token': window.csrfToken ?? ''
|
|
9
10
|
}
|
|
10
|
-
}
|
|
11
|
+
},
|
|
12
|
+
logger: logger
|
|
11
13
|
});
|
|
12
14
|
const src = {
|
|
13
15
|
version: version
|
package/lib/utils/axiosConfig.js
CHANGED
|
@@ -144,9 +144,9 @@ function initAxiosConfig(axiosInstance) {
|
|
|
144
144
|
'post',
|
|
145
145
|
'put',
|
|
146
146
|
'patch',
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
'postForm',
|
|
148
|
+
'putForm',
|
|
149
|
+
'patchForm'
|
|
150
150
|
];
|
|
151
151
|
const allMethods = [
|
|
152
152
|
'request',
|
|
@@ -260,5 +260,13 @@ function initAxiosConfig(axiosInstance) {
|
|
|
260
260
|
logResponse('error', error.response || error);
|
|
261
261
|
return Promise.reject(error);
|
|
262
262
|
});
|
|
263
|
+
if ('function' == typeof axiosInstance) axiosInstance = new Proxy(axiosInstance, {
|
|
264
|
+
apply (target, thisArg, args) {
|
|
265
|
+
const requestMethod = target.request;
|
|
266
|
+
if ('function' != typeof requestMethod) return Reflect.apply(target, thisArg, args);
|
|
267
|
+
return requestMethod.apply(target, args);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
return axiosInstance;
|
|
263
271
|
}
|
|
264
272
|
export { initAxiosConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.16",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@ant-design/colors": "^7.2.1",
|
|
87
87
|
"@ant-design/cssinjs": "^1.24.0",
|
|
88
88
|
"@data-loom/js": "^0.4.3",
|
|
89
|
-
"@lark-apaas/client-capability": "^0.1.
|
|
89
|
+
"@lark-apaas/client-capability": "^0.1.2",
|
|
90
90
|
"@lark-apaas/miaoda-inspector": "^1.0.8",
|
|
91
91
|
"@lark-apaas/observable-web": "1.0.1-alpha.2",
|
|
92
92
|
"@radix-ui/react-avatar": "^1.1.10",
|