@jetlinks-web/core 2.0.7 → 2.0.8
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/package.json +2 -2
- package/src/axios.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetlinks-web/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"module": "index.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"axios": "^1.7.4",
|
|
19
|
-
"@jetlinks-web/constants": "^1.0.7",
|
|
20
19
|
"@jetlinks-web/types": "^1.0.2",
|
|
20
|
+
"@jetlinks-web/constants": "^1.0.7",
|
|
21
21
|
"@jetlinks-web/utils": "^1.2.5"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
package/src/axios.ts
CHANGED
|
@@ -59,6 +59,10 @@ const handleRequest = (config: InternalAxiosRequestConfig) => {
|
|
|
59
59
|
const token = getToken()
|
|
60
60
|
const lang = localStorage.getItem(_options.langKey)
|
|
61
61
|
|
|
62
|
+
if (lang) {
|
|
63
|
+
config.headers[_options.langKey] = lang
|
|
64
|
+
}
|
|
65
|
+
|
|
62
66
|
// 没有token,并且该接口需要token校验
|
|
63
67
|
if (!token && !_options.filter_url?.some((url) => config.url?.includes(url))) {
|
|
64
68
|
// 跳转登录页
|
|
@@ -70,10 +74,6 @@ const handleRequest = (config: InternalAxiosRequestConfig) => {
|
|
|
70
74
|
config.headers[TOKEN_KEY] = token
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
if (lang) {
|
|
74
|
-
config.headers[_options.langKey] = lang
|
|
75
|
-
}
|
|
76
|
-
|
|
77
77
|
if (_options.requestOptions && isFunction(_options.requestOptions)) {
|
|
78
78
|
const extraOptions = _options.requestOptions(config)
|
|
79
79
|
if (extraOptions && isObject(extraOptions)) {
|