el-plus 0.0.115 → 0.0.116
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/CHANGELOG.md +6 -0
- package/dist/index.full.js +28 -6
- package/dist/index.full.min.js +4 -4
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +4 -4
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +28 -6
- package/es/package.json.mjs +1 -1
- package/es/utils/http/core/modules/interceptor.d.ts +4 -3
- package/es/utils/http/core/modules/interceptor.mjs +26 -4
- package/es/utils/http/core/modules/interceptor.mjs.map +1 -1
- package/es/utils/http/core/types.d.ts +4 -1
- package/lib/package.json.js +1 -1
- package/lib/utils/http/core/modules/interceptor.d.ts +4 -3
- package/lib/utils/http/core/modules/interceptor.js +26 -4
- package/lib/utils/http/core/modules/interceptor.js.map +1 -1
- package/lib/utils/http/core/types.d.ts +4 -1
- package/package.json +1 -1
package/dist/index.full.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! ElPlus v0.0.
|
|
1
|
+
/*! ElPlus v0.0.116 */
|
|
2
2
|
|
|
3
3
|
import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, reactive, onBeforeUpdate, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString, useSlots, watch, createSlots, normalizeProps, guardReactiveProps, markRaw, Transition, shallowReactive, isVNode, render, createElementVNode, toRaw, onMounted } from 'vue';
|
|
4
4
|
import { buttonProps, useLocale as useLocale$1, ElLoading, ElMessage, ElMessageBox, formProps as formProps$1, formEmits as formEmits$1, ElTooltip, formItemProps as formItemProps$1, ElFormItem, ElForm, ElRow, ElCol, inputProps as inputProps$1, inputEmits as inputEmits$1, configProviderContextKey, ElConfigProvider, ElDialog, ElButton, ElTable, ElIcon, selectProps as selectProps$1, selectEmits as selectEmits$1, ElPageHeader, datePickerProps, linkProps as linkProps$1, ElSkeleton } from 'element-plus';
|
|
@@ -455,14 +455,36 @@ class InterceptorManager {
|
|
|
455
455
|
addRequestInterceptor({
|
|
456
456
|
fulfilled,
|
|
457
457
|
rejected
|
|
458
|
-
} = defaultRequestInterceptorConfig) {
|
|
459
|
-
|
|
458
|
+
} = defaultRequestInterceptorConfig, options) {
|
|
459
|
+
if (options?.prepend) {
|
|
460
|
+
this.prependInterceptor("request", fulfilled, rejected);
|
|
461
|
+
} else {
|
|
462
|
+
this.axiosInstance.interceptors.request.use(fulfilled, rejected);
|
|
463
|
+
}
|
|
460
464
|
}
|
|
461
465
|
addResponseInterceptor({
|
|
462
466
|
fulfilled,
|
|
463
467
|
rejected
|
|
464
|
-
} = defaultResponseInterceptorConfig) {
|
|
465
|
-
|
|
468
|
+
} = defaultResponseInterceptorConfig, options) {
|
|
469
|
+
if (options?.prepend) {
|
|
470
|
+
this.prependInterceptor("response", fulfilled, rejected);
|
|
471
|
+
} else {
|
|
472
|
+
this.axiosInstance.interceptors.response.use(fulfilled, rejected);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* 插入到拦截器链头部(先于已注册的拦截器执行)。
|
|
477
|
+
* axios 拦截器按注册顺序执行且未提供前插 API,
|
|
478
|
+
* 此处直接 unshift 到其内部 handlers 数组,结构与 use() 注册的一致(axios 1.x 稳定结构)
|
|
479
|
+
*/
|
|
480
|
+
prependInterceptor(type, fulfilled, rejected) {
|
|
481
|
+
const manager = this.axiosInstance.interceptors[type];
|
|
482
|
+
manager.handlers.unshift({
|
|
483
|
+
fulfilled,
|
|
484
|
+
rejected,
|
|
485
|
+
synchronous: false,
|
|
486
|
+
runWhen: null
|
|
487
|
+
});
|
|
466
488
|
}
|
|
467
489
|
}
|
|
468
490
|
|
|
@@ -4564,7 +4586,7 @@ var components = [
|
|
|
4564
4586
|
EpFooterInfo
|
|
4565
4587
|
];
|
|
4566
4588
|
|
|
4567
|
-
var version = "0.0.
|
|
4589
|
+
var version = "0.0.116";
|
|
4568
4590
|
|
|
4569
4591
|
var globalProperties = {
|
|
4570
4592
|
install(app) {
|
package/es/package.json.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AxiosInstance } from 'axios';
|
|
2
|
-
import type { RequestInterceptorConfig, ResponseInterceptorConfig } from '../types';
|
|
2
|
+
import type { AddInterceptorOptions, RequestInterceptorConfig, ResponseInterceptorConfig } from '../types';
|
|
3
3
|
declare class InterceptorManager {
|
|
4
4
|
private axiosInstance;
|
|
5
5
|
constructor(instance: AxiosInstance);
|
|
6
|
-
addRequestInterceptor({ fulfilled, rejected, }?: RequestInterceptorConfig): void;
|
|
7
|
-
addResponseInterceptor<T = any>({ fulfilled, rejected, }?: ResponseInterceptorConfig<T
|
|
6
|
+
addRequestInterceptor({ fulfilled, rejected, }?: RequestInterceptorConfig, options?: AddInterceptorOptions): void;
|
|
7
|
+
addResponseInterceptor<T = any>({ fulfilled, rejected, }?: ResponseInterceptorConfig<T>, options?: AddInterceptorOptions): void;
|
|
8
|
+
private prependInterceptor;
|
|
8
9
|
}
|
|
9
10
|
export { InterceptorManager };
|
|
@@ -13,14 +13,36 @@ class InterceptorManager {
|
|
|
13
13
|
addRequestInterceptor({
|
|
14
14
|
fulfilled,
|
|
15
15
|
rejected
|
|
16
|
-
} = defaultRequestInterceptorConfig) {
|
|
17
|
-
|
|
16
|
+
} = defaultRequestInterceptorConfig, options) {
|
|
17
|
+
if (options?.prepend) {
|
|
18
|
+
this.prependInterceptor("request", fulfilled, rejected);
|
|
19
|
+
} else {
|
|
20
|
+
this.axiosInstance.interceptors.request.use(fulfilled, rejected);
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
addResponseInterceptor({
|
|
20
24
|
fulfilled,
|
|
21
25
|
rejected
|
|
22
|
-
} = defaultResponseInterceptorConfig) {
|
|
23
|
-
|
|
26
|
+
} = defaultResponseInterceptorConfig, options) {
|
|
27
|
+
if (options?.prepend) {
|
|
28
|
+
this.prependInterceptor("response", fulfilled, rejected);
|
|
29
|
+
} else {
|
|
30
|
+
this.axiosInstance.interceptors.response.use(fulfilled, rejected);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 插入到拦截器链头部(先于已注册的拦截器执行)。
|
|
35
|
+
* axios 拦截器按注册顺序执行且未提供前插 API,
|
|
36
|
+
* 此处直接 unshift 到其内部 handlers 数组,结构与 use() 注册的一致(axios 1.x 稳定结构)
|
|
37
|
+
*/
|
|
38
|
+
prependInterceptor(type, fulfilled, rejected) {
|
|
39
|
+
const manager = this.axiosInstance.interceptors[type];
|
|
40
|
+
manager.handlers.unshift({
|
|
41
|
+
fulfilled,
|
|
42
|
+
rejected,
|
|
43
|
+
synchronous: false,
|
|
44
|
+
runWhen: null
|
|
45
|
+
});
|
|
24
46
|
}
|
|
25
47
|
}
|
|
26
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor.mjs","sources":["../../../../../../../packages/utils/http/core/modules/interceptor.ts"],"sourcesContent":["import type { AxiosInstance, AxiosResponse } from 'axios'
|
|
1
|
+
{"version":3,"file":"interceptor.mjs","sources":["../../../../../../../packages/utils/http/core/modules/interceptor.ts"],"sourcesContent":["import type { AxiosInstance, AxiosResponse } from 'axios'\n\nimport type {\n AddInterceptorOptions,\n RequestInterceptorConfig,\n ResponseInterceptorConfig,\n} from '../types'\n\nconst defaultRequestInterceptorConfig: RequestInterceptorConfig = {\n fulfilled: (response) => response,\n rejected: (error) => Promise.reject(error),\n}\n\nconst defaultResponseInterceptorConfig: ResponseInterceptorConfig = {\n fulfilled: (response: AxiosResponse) => response,\n rejected: (error) => Promise.reject(error),\n}\n\nclass InterceptorManager {\n private axiosInstance: AxiosInstance\n\n constructor(instance: AxiosInstance) {\n this.axiosInstance = instance\n }\n\n addRequestInterceptor(\n {\n fulfilled,\n rejected,\n }: RequestInterceptorConfig = defaultRequestInterceptorConfig,\n options?: AddInterceptorOptions,\n ) {\n if (options?.prepend) {\n this.prependInterceptor('request', fulfilled, rejected)\n } else {\n this.axiosInstance.interceptors.request.use(fulfilled, rejected)\n }\n }\n\n addResponseInterceptor<T = any>(\n {\n fulfilled,\n rejected,\n }: ResponseInterceptorConfig<T> = defaultResponseInterceptorConfig,\n options?: AddInterceptorOptions,\n ) {\n if (options?.prepend) {\n this.prependInterceptor('response', fulfilled, rejected)\n } else {\n this.axiosInstance.interceptors.response.use(fulfilled, rejected)\n }\n }\n\n /**\n * 插入到拦截器链头部(先于已注册的拦截器执行)。\n * axios 拦截器按注册顺序执行且未提供前插 API,\n * 此处直接 unshift 到其内部 handlers 数组,结构与 use() 注册的一致(axios 1.x 稳定结构)\n */\n private prependInterceptor(\n type: 'request' | 'response',\n fulfilled?: (...args: any[]) => any,\n rejected?: (error: any) => any,\n ) {\n const manager: any = this.axiosInstance.interceptors[type]\n manager.handlers.unshift({\n fulfilled,\n rejected,\n synchronous: false,\n runWhen: null,\n })\n }\n}\n\nexport { InterceptorManager }\n"],"names":[],"mappings":"AAQA,MAAM,+BAAA,GAA4D;AAAA,EAChE,SAAA,EAAW,CAAC,QAAA,KAAa,QAAA;AAAA,EACzB,QAAA,EAAU,CAAC,KAAA,KAAU,OAAA,CAAQ,OAAO,KAAK;AAC3C,CAAA;AAEA,MAAM,gCAAA,GAA8D;AAAA,EAClE,SAAA,EAAW,CAAC,QAAA,KAA4B,QAAA;AAAA,EACxC,QAAA,EAAU,CAAC,KAAA,KAAU,OAAA,CAAQ,OAAO,KAAK;AAC3C,CAAA;AAEA,MAAM,kBAAA,CAAmB;AAAA,EAGvB,YAAY,QAAA,EAAyB;AACnC,IAAA,IAAA,CAAK,aAAA,GAAgB,QAAA;AAAA,EACvB;AAAA,EAEA,qBAAA,CACE;AAAA,IACE,SAAA;AAAA,IACA;AAAA,GACF,GAA8B,iCAC9B,OAAA,EACA;AACA,IAAA,IAAI,SAAS,OAAA,EAAS;AACpB,MAAA,IAAA,CAAK,kBAAA,CAAmB,SAAA,EAAW,SAAA,EAAW,QAAQ,CAAA;AAAA,IACxD,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,aAAA,CAAc,YAAA,CAAa,OAAA,CAAQ,GAAA,CAAI,WAAW,QAAQ,CAAA;AAAA,IACjE;AAAA,EACF;AAAA,EAEA,sBAAA,CACE;AAAA,IACE,SAAA;AAAA,IACA;AAAA,GACF,GAAkC,kCAClC,OAAA,EACA;AACA,IAAA,IAAI,SAAS,OAAA,EAAS;AACpB,MAAA,IAAA,CAAK,kBAAA,CAAmB,UAAA,EAAY,SAAA,EAAW,QAAQ,CAAA;AAAA,IACzD,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,aAAA,CAAc,YAAA,CAAa,QAAA,CAAS,GAAA,CAAI,WAAW,QAAQ,CAAA;AAAA,IAClE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,kBAAA,CACN,IAAA,EACA,SAAA,EACA,QAAA,EACA;AACA,IAAA,MAAM,OAAA,GAAe,IAAA,CAAK,aAAA,CAAc,YAAA,CAAa,IAAI,CAAA;AACzD,IAAA,OAAA,CAAQ,SAAS,OAAA,CAAQ;AAAA,MACvB,SAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA,EAAa,KAAA;AAAA,MACb,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACF;;;;"}
|
|
@@ -25,6 +25,9 @@ interface ResponseInterceptorConfig<T = any> {
|
|
|
25
25
|
rejected?: (error: any) => any;
|
|
26
26
|
}
|
|
27
27
|
type MakeErrorMessageFn = (message: string, error: any) => void;
|
|
28
|
+
interface AddInterceptorOptions {
|
|
29
|
+
prepend?: boolean;
|
|
30
|
+
}
|
|
28
31
|
interface HttpResponse<T = any> {
|
|
29
32
|
code: number;
|
|
30
33
|
data: T;
|
|
@@ -41,4 +44,4 @@ export type ApiFunction = (params?: Record<string, unknown>) => Promise<RequestR
|
|
|
41
44
|
export type Api = string | ApiFunction;
|
|
42
45
|
export type ReqBefore = (config: RequestClientConfig) => RequestClientConfig | void;
|
|
43
46
|
export type ReqAfter = (response: RequestResponse) => void;
|
|
44
|
-
export type { HttpResponse, HttpSuccessResponse, MakeErrorMessageFn, RequestClientConfig, RequestClientOptions, RequestContentType, RequestInterceptorConfig, RequestResponse, ResponseInterceptorConfig, SseRequestOptions, };
|
|
47
|
+
export type { AddInterceptorOptions, HttpResponse, HttpSuccessResponse, MakeErrorMessageFn, RequestClientConfig, RequestClientOptions, RequestContentType, RequestInterceptorConfig, RequestResponse, ResponseInterceptorConfig, SseRequestOptions, };
|
package/lib/package.json.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AxiosInstance } from 'axios';
|
|
2
|
-
import type { RequestInterceptorConfig, ResponseInterceptorConfig } from '../types';
|
|
2
|
+
import type { AddInterceptorOptions, RequestInterceptorConfig, ResponseInterceptorConfig } from '../types';
|
|
3
3
|
declare class InterceptorManager {
|
|
4
4
|
private axiosInstance;
|
|
5
5
|
constructor(instance: AxiosInstance);
|
|
6
|
-
addRequestInterceptor({ fulfilled, rejected, }?: RequestInterceptorConfig): void;
|
|
7
|
-
addResponseInterceptor<T = any>({ fulfilled, rejected, }?: ResponseInterceptorConfig<T
|
|
6
|
+
addRequestInterceptor({ fulfilled, rejected, }?: RequestInterceptorConfig, options?: AddInterceptorOptions): void;
|
|
7
|
+
addResponseInterceptor<T = any>({ fulfilled, rejected, }?: ResponseInterceptorConfig<T>, options?: AddInterceptorOptions): void;
|
|
8
|
+
private prependInterceptor;
|
|
8
9
|
}
|
|
9
10
|
export { InterceptorManager };
|
|
@@ -15,14 +15,36 @@ class InterceptorManager {
|
|
|
15
15
|
addRequestInterceptor({
|
|
16
16
|
fulfilled,
|
|
17
17
|
rejected
|
|
18
|
-
} = defaultRequestInterceptorConfig) {
|
|
19
|
-
|
|
18
|
+
} = defaultRequestInterceptorConfig, options) {
|
|
19
|
+
if (options?.prepend) {
|
|
20
|
+
this.prependInterceptor("request", fulfilled, rejected);
|
|
21
|
+
} else {
|
|
22
|
+
this.axiosInstance.interceptors.request.use(fulfilled, rejected);
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
addResponseInterceptor({
|
|
22
26
|
fulfilled,
|
|
23
27
|
rejected
|
|
24
|
-
} = defaultResponseInterceptorConfig) {
|
|
25
|
-
|
|
28
|
+
} = defaultResponseInterceptorConfig, options) {
|
|
29
|
+
if (options?.prepend) {
|
|
30
|
+
this.prependInterceptor("response", fulfilled, rejected);
|
|
31
|
+
} else {
|
|
32
|
+
this.axiosInstance.interceptors.response.use(fulfilled, rejected);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 插入到拦截器链头部(先于已注册的拦截器执行)。
|
|
37
|
+
* axios 拦截器按注册顺序执行且未提供前插 API,
|
|
38
|
+
* 此处直接 unshift 到其内部 handlers 数组,结构与 use() 注册的一致(axios 1.x 稳定结构)
|
|
39
|
+
*/
|
|
40
|
+
prependInterceptor(type, fulfilled, rejected) {
|
|
41
|
+
const manager = this.axiosInstance.interceptors[type];
|
|
42
|
+
manager.handlers.unshift({
|
|
43
|
+
fulfilled,
|
|
44
|
+
rejected,
|
|
45
|
+
synchronous: false,
|
|
46
|
+
runWhen: null
|
|
47
|
+
});
|
|
26
48
|
}
|
|
27
49
|
}
|
|
28
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor.js","sources":["../../../../../../../packages/utils/http/core/modules/interceptor.ts"],"sourcesContent":["import type { AxiosInstance, AxiosResponse } from 'axios'
|
|
1
|
+
{"version":3,"file":"interceptor.js","sources":["../../../../../../../packages/utils/http/core/modules/interceptor.ts"],"sourcesContent":["import type { AxiosInstance, AxiosResponse } from 'axios'\n\nimport type {\n AddInterceptorOptions,\n RequestInterceptorConfig,\n ResponseInterceptorConfig,\n} from '../types'\n\nconst defaultRequestInterceptorConfig: RequestInterceptorConfig = {\n fulfilled: (response) => response,\n rejected: (error) => Promise.reject(error),\n}\n\nconst defaultResponseInterceptorConfig: ResponseInterceptorConfig = {\n fulfilled: (response: AxiosResponse) => response,\n rejected: (error) => Promise.reject(error),\n}\n\nclass InterceptorManager {\n private axiosInstance: AxiosInstance\n\n constructor(instance: AxiosInstance) {\n this.axiosInstance = instance\n }\n\n addRequestInterceptor(\n {\n fulfilled,\n rejected,\n }: RequestInterceptorConfig = defaultRequestInterceptorConfig,\n options?: AddInterceptorOptions,\n ) {\n if (options?.prepend) {\n this.prependInterceptor('request', fulfilled, rejected)\n } else {\n this.axiosInstance.interceptors.request.use(fulfilled, rejected)\n }\n }\n\n addResponseInterceptor<T = any>(\n {\n fulfilled,\n rejected,\n }: ResponseInterceptorConfig<T> = defaultResponseInterceptorConfig,\n options?: AddInterceptorOptions,\n ) {\n if (options?.prepend) {\n this.prependInterceptor('response', fulfilled, rejected)\n } else {\n this.axiosInstance.interceptors.response.use(fulfilled, rejected)\n }\n }\n\n /**\n * 插入到拦截器链头部(先于已注册的拦截器执行)。\n * axios 拦截器按注册顺序执行且未提供前插 API,\n * 此处直接 unshift 到其内部 handlers 数组,结构与 use() 注册的一致(axios 1.x 稳定结构)\n */\n private prependInterceptor(\n type: 'request' | 'response',\n fulfilled?: (...args: any[]) => any,\n rejected?: (error: any) => any,\n ) {\n const manager: any = this.axiosInstance.interceptors[type]\n manager.handlers.unshift({\n fulfilled,\n rejected,\n synchronous: false,\n runWhen: null,\n })\n }\n}\n\nexport { InterceptorManager }\n"],"names":[],"mappings":";;AAQA,MAAM,+BAAA,GAA4D;AAAA,EAChE,SAAA,EAAW,CAAC,QAAA,KAAa,QAAA;AAAA,EACzB,QAAA,EAAU,CAAC,KAAA,KAAU,OAAA,CAAQ,OAAO,KAAK;AAC3C,CAAA;AAEA,MAAM,gCAAA,GAA8D;AAAA,EAClE,SAAA,EAAW,CAAC,QAAA,KAA4B,QAAA;AAAA,EACxC,QAAA,EAAU,CAAC,KAAA,KAAU,OAAA,CAAQ,OAAO,KAAK;AAC3C,CAAA;AAEA,MAAM,kBAAA,CAAmB;AAAA,EAGvB,YAAY,QAAA,EAAyB;AACnC,IAAA,IAAA,CAAK,aAAA,GAAgB,QAAA;AAAA,EACvB;AAAA,EAEA,qBAAA,CACE;AAAA,IACE,SAAA;AAAA,IACA;AAAA,GACF,GAA8B,iCAC9B,OAAA,EACA;AACA,IAAA,IAAI,SAAS,OAAA,EAAS;AACpB,MAAA,IAAA,CAAK,kBAAA,CAAmB,SAAA,EAAW,SAAA,EAAW,QAAQ,CAAA;AAAA,IACxD,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,aAAA,CAAc,YAAA,CAAa,OAAA,CAAQ,GAAA,CAAI,WAAW,QAAQ,CAAA;AAAA,IACjE;AAAA,EACF;AAAA,EAEA,sBAAA,CACE;AAAA,IACE,SAAA;AAAA,IACA;AAAA,GACF,GAAkC,kCAClC,OAAA,EACA;AACA,IAAA,IAAI,SAAS,OAAA,EAAS;AACpB,MAAA,IAAA,CAAK,kBAAA,CAAmB,UAAA,EAAY,SAAA,EAAW,QAAQ,CAAA;AAAA,IACzD,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,aAAA,CAAc,YAAA,CAAa,QAAA,CAAS,GAAA,CAAI,WAAW,QAAQ,CAAA;AAAA,IAClE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,kBAAA,CACN,IAAA,EACA,SAAA,EACA,QAAA,EACA;AACA,IAAA,MAAM,OAAA,GAAe,IAAA,CAAK,aAAA,CAAc,YAAA,CAAa,IAAI,CAAA;AACzD,IAAA,OAAA,CAAQ,SAAS,OAAA,CAAQ;AAAA,MACvB,SAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA,EAAa,KAAA;AAAA,MACb,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACF;;;;"}
|
|
@@ -25,6 +25,9 @@ interface ResponseInterceptorConfig<T = any> {
|
|
|
25
25
|
rejected?: (error: any) => any;
|
|
26
26
|
}
|
|
27
27
|
type MakeErrorMessageFn = (message: string, error: any) => void;
|
|
28
|
+
interface AddInterceptorOptions {
|
|
29
|
+
prepend?: boolean;
|
|
30
|
+
}
|
|
28
31
|
interface HttpResponse<T = any> {
|
|
29
32
|
code: number;
|
|
30
33
|
data: T;
|
|
@@ -41,4 +44,4 @@ export type ApiFunction = (params?: Record<string, unknown>) => Promise<RequestR
|
|
|
41
44
|
export type Api = string | ApiFunction;
|
|
42
45
|
export type ReqBefore = (config: RequestClientConfig) => RequestClientConfig | void;
|
|
43
46
|
export type ReqAfter = (response: RequestResponse) => void;
|
|
44
|
-
export type { HttpResponse, HttpSuccessResponse, MakeErrorMessageFn, RequestClientConfig, RequestClientOptions, RequestContentType, RequestInterceptorConfig, RequestResponse, ResponseInterceptorConfig, SseRequestOptions, };
|
|
47
|
+
export type { AddInterceptorOptions, HttpResponse, HttpSuccessResponse, MakeErrorMessageFn, RequestClientConfig, RequestClientOptions, RequestContentType, RequestInterceptorConfig, RequestResponse, ResponseInterceptorConfig, SseRequestOptions, };
|