@jetlinks-web/core 1.0.4 → 1.0.6
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 +3 -3
- package/src/request/axios.ts +5 -3
- package/src/request/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetlinks-web/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"module": "index.ts",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"lodash-es": "^4.17.21",
|
|
17
17
|
"axios": "^1.4.0",
|
|
18
18
|
"rxjs": "^7.8.1",
|
|
19
|
-
"@jetlinks-web/router": "^1.0.5",
|
|
20
19
|
"@jetlinks-web/constants": "^1.0.1",
|
|
20
|
+
"@jetlinks-web/router": "^1.0.7",
|
|
21
21
|
"@jetlinks-web/types": "^1.0.1",
|
|
22
|
-
"@jetlinks-web/utils": "^1.0.
|
|
22
|
+
"@jetlinks-web/utils": "^1.0.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/lodash-es": "^4.17.7",
|
package/src/request/axios.ts
CHANGED
|
@@ -10,8 +10,9 @@ import type {
|
|
|
10
10
|
InternalAxiosRequestConfig,
|
|
11
11
|
} from 'axios'
|
|
12
12
|
import { notification as Notification } from 'jetlinks-ui-components'
|
|
13
|
-
import { isFunction } from 'lodash-es'
|
|
13
|
+
import { isFunction, merge } from 'lodash-es'
|
|
14
14
|
import type { AxiosResponseRewrite } from '@jetlinks-web/types'
|
|
15
|
+
import { context } from './context'
|
|
15
16
|
|
|
16
17
|
export interface ContextOptions {
|
|
17
18
|
filterUrl?: string[]
|
|
@@ -31,7 +32,7 @@ export class Axios {
|
|
|
31
32
|
private readonly options: CreateAxiosOptions
|
|
32
33
|
|
|
33
34
|
constructor(options: CreateAxiosOptions) {
|
|
34
|
-
this.options = options
|
|
35
|
+
this.options = merge(context, options)
|
|
35
36
|
this.axiosInstance = axios.create({
|
|
36
37
|
withCredentials: false,
|
|
37
38
|
timeout: 1000 * 15,
|
|
@@ -166,11 +167,12 @@ export class Axios {
|
|
|
166
167
|
})
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
remove<T = any>(url: string, params: any = undefined, ext?: any) {
|
|
170
|
+
remove<T = any>(url: string, params: any = undefined, data?: any, ext?: any) {
|
|
170
171
|
return this.axiosInstance<any, AxiosResponseRewrite<T>>({
|
|
171
172
|
method: 'DELETE',
|
|
172
173
|
url,
|
|
173
174
|
params,
|
|
175
|
+
data,
|
|
174
176
|
...ext,
|
|
175
177
|
})
|
|
176
178
|
}
|
package/src/request/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { context } from './context'
|
|
|
5
5
|
export { initRequest } from './context'
|
|
6
6
|
|
|
7
7
|
export const createAxios = (options?: Partial<CreateAxiosOptions>) => {
|
|
8
|
-
return new Axios(
|
|
8
|
+
return new Axios(options)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const request = createAxios()
|