@clownlee/cores 1.0.20 → 1.0.21
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.d.ts +1 -1
- package/dist/index.js +4 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as init } from '@clownlee/http';
|
|
2
2
|
|
|
3
3
|
export declare const initHttp: typeof init;
|
|
4
|
-
export type { RequestInitConfig, RefreshConfig, HttpRequestConfig, HttpResponse, HttpInstance, TokenResponse, } from '@clownlee/http';
|
|
4
|
+
export type { RequestInitConfig, RefreshConfig, HttpRequestConfig, HttpResponse, HttpStreamResponse, HttpInstance, TokenResponse, } from '@clownlee/http';
|
|
5
5
|
export * from './apis';
|
|
6
6
|
export * from './ui/permission-btn';
|
|
7
7
|
export * from './ui/permission-table';
|
package/dist/index.js
CHANGED
|
@@ -2708,7 +2708,7 @@ async function handleResponseInterceptor(response, store, refreshConfig) {
|
|
|
2708
2708
|
throw refreshError;
|
|
2709
2709
|
}
|
|
2710
2710
|
} else if (code > 0 && code !== TENANT_SUPER_ADMIN_FIRST_LOGIN_CODE) {
|
|
2711
|
-
throw new Error((responseData == null ? void 0 : responseData.message
|
|
2711
|
+
throw new Error((responseData == null ? void 0 : responseData.message) ?? "请求失败");
|
|
2712
2712
|
}
|
|
2713
2713
|
return response;
|
|
2714
2714
|
}
|
|
@@ -2789,11 +2789,8 @@ class RequestServiceClass {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
return this.instance;
|
|
2791
2791
|
}
|
|
2792
|
-
/**
|
|
2793
|
-
* 通用请求方法
|
|
2794
|
-
*/
|
|
2795
2792
|
async request(config) {
|
|
2796
|
-
var _a;
|
|
2793
|
+
var _a, _b;
|
|
2797
2794
|
const instance = this.getInstance();
|
|
2798
2795
|
const axiosConfig = {
|
|
2799
2796
|
...config,
|
|
@@ -2801,7 +2798,8 @@ class RequestServiceClass {
|
|
|
2801
2798
|
cancelToken: config.cancelToken && "token" in config.cancelToken ? config.cancelToken.token : config.cancelToken
|
|
2802
2799
|
};
|
|
2803
2800
|
const response = await instance.request(axiosConfig);
|
|
2804
|
-
|
|
2801
|
+
const isBlobResponse = config.responseType === "blob" || ((_a = config.headers) == null ? void 0 : _a.responseType) === "blob" || ((_b = response.headers["content-type"]) == null ? void 0 : _b.includes("application/octet-stream"));
|
|
2802
|
+
if (isBlobResponse) {
|
|
2805
2803
|
return response;
|
|
2806
2804
|
}
|
|
2807
2805
|
return response.data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clownlee/cores",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
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.8",
|
|
34
34
|
"pinia": "^2.1.7",
|
|
35
35
|
"vue": "^3.5.25",
|
|
36
36
|
"cropper": "^4.1.0",
|