@clownlee/cores 1.0.18 → 1.0.19
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/index.js +15 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2669,6 +2669,17 @@ async function handleResponseInterceptor(response, store, refreshConfig) {
|
|
|
2669
2669
|
throw new Error(responseData == null ? void 0 : responseData.message);
|
|
2670
2670
|
} else if (code === 2001) {
|
|
2671
2671
|
const config = response.config;
|
|
2672
|
+
if (config._retry) {
|
|
2673
|
+
window.parent.postMessage({
|
|
2674
|
+
type: "error",
|
|
2675
|
+
data: JSON.stringify({
|
|
2676
|
+
code: responseData == null ? void 0 : responseData.code,
|
|
2677
|
+
message: responseData == null ? void 0 : responseData.message,
|
|
2678
|
+
action: "toLogin"
|
|
2679
|
+
})
|
|
2680
|
+
}, "*");
|
|
2681
|
+
throw new Error(responseData == null ? void 0 : responseData.message);
|
|
2682
|
+
}
|
|
2672
2683
|
if (!refreshConfig || !store) {
|
|
2673
2684
|
return response;
|
|
2674
2685
|
}
|
|
@@ -2779,6 +2790,7 @@ class RequestServiceClass {
|
|
|
2779
2790
|
* 通用请求方法
|
|
2780
2791
|
*/
|
|
2781
2792
|
async request(config) {
|
|
2793
|
+
var _a;
|
|
2782
2794
|
const instance = this.getInstance();
|
|
2783
2795
|
const axiosConfig = {
|
|
2784
2796
|
...config,
|
|
@@ -2786,6 +2798,9 @@ class RequestServiceClass {
|
|
|
2786
2798
|
cancelToken: config.cancelToken && "token" in config.cancelToken ? config.cancelToken.token : config.cancelToken
|
|
2787
2799
|
};
|
|
2788
2800
|
const response = await instance.request(axiosConfig);
|
|
2801
|
+
if ((_a = response.headers["content-type"]) == null ? void 0 : _a.includes("application/octet-stream")) {
|
|
2802
|
+
return response;
|
|
2803
|
+
}
|
|
2789
2804
|
return response.data;
|
|
2790
2805
|
}
|
|
2791
2806
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clownlee/cores",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "公共核心库,提供统一的 HTTP 请求能力和自动 token 刷新功能",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@clownlee/http": "^1.0.
|
|
33
|
+
"@clownlee/http": "^1.0.5",
|
|
34
34
|
"pinia": "^2.1.7",
|
|
35
35
|
"vue": "^3.5.25",
|
|
36
36
|
"cropper": "^4.1.0",
|