@jetlinks-web/core 2.0.2 → 2.0.4
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 +4 -4
- package/src/axios.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetlinks-web/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"module": "index.ts",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"axios": "^1.7.4",
|
|
19
|
-
"@jetlinks-web/constants": "^1.0.
|
|
20
|
-
"@jetlinks-web/
|
|
21
|
-
"@jetlinks-web/
|
|
19
|
+
"@jetlinks-web/constants": "^1.0.7",
|
|
20
|
+
"@jetlinks-web/utils": "^1.2.5",
|
|
21
|
+
"@jetlinks-web/types": "^1.0.2"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"registry": "https://registry.npmjs.org/",
|
package/src/axios.ts
CHANGED
|
@@ -59,7 +59,9 @@ const handleRequest = (config: InternalAxiosRequestConfig) => {
|
|
|
59
59
|
return config
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
config.headers[TOKEN_KEY]
|
|
62
|
+
if (!config.headers[TOKEN_KEY]) {
|
|
63
|
+
config.headers[TOKEN_KEY] = token
|
|
64
|
+
}
|
|
63
65
|
|
|
64
66
|
if (_options.requestOptions && isFunction(_options.requestOptions)) {
|
|
65
67
|
const extraOptions = _options.requestOptions(config)
|
|
@@ -98,7 +100,7 @@ const handleResponse = (response: AxiosResponse) => {
|
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
const errorHandler = (err: AxiosError<any>) => {
|
|
101
|
-
let description = 'Error'
|
|
103
|
+
let description = err.response?.message || 'Error'
|
|
102
104
|
let _status: string | number = 0
|
|
103
105
|
if (err.response) {
|
|
104
106
|
const {data, status} = err.response
|