@lark-apaas/client-toolkit 1.1.28-alpha.axios.1 → 1.1.28
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.
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
declare module 'axios' {
|
|
3
|
-
interface AxiosRequestConfig {
|
|
4
|
-
meta?: {
|
|
5
|
-
jumpToLogin?: boolean;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
2
|
/** 获取axios实例 */
|
|
10
3
|
export declare function getAxiosForBackend(): AxiosInstance;
|
|
11
4
|
export declare const axiosForBackend: AxiosInstance;
|
|
@@ -6,13 +6,6 @@ function getAxiosForBackend() {
|
|
|
6
6
|
axiosInstance = axios.create({
|
|
7
7
|
baseURL: process.env.CLIENT_BASE_PATH || '/'
|
|
8
8
|
});
|
|
9
|
-
axiosInstance.interceptors.response.use((res)=>{
|
|
10
|
-
if (res.config.meta?.jumpToLogin !== false) {
|
|
11
|
-
const loginUrl = res.headers['x-login-url'];
|
|
12
|
-
if (loginUrl) window.location.href = loginUrl;
|
|
13
|
-
}
|
|
14
|
-
return res;
|
|
15
|
-
});
|
|
16
9
|
initAxiosConfig(axiosInstance);
|
|
17
10
|
}
|
|
18
11
|
return axiosInstance;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.1.28
|
|
3
|
+
"version": "1.1.28",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -149,9 +149,9 @@
|
|
|
149
149
|
},
|
|
150
150
|
"peerDependencies": {
|
|
151
151
|
"antd": ">=5.26.6",
|
|
152
|
+
"styled-jsx": ">=5.0.0",
|
|
152
153
|
"react": ">=16.14.0",
|
|
153
154
|
"react-dom": ">=16.14.0",
|
|
154
|
-
"react-router-dom": ">=6.26.2"
|
|
155
|
-
"styled-jsx": ">=5.0.0"
|
|
155
|
+
"react-router-dom": ">=6.26.2"
|
|
156
156
|
}
|
|
157
157
|
}
|