Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 3dab167

Browse files
committed
fix: 修复弹窗上报action & product 丢失的问题
1 parent f2d0d8e commit 3dab167

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

packages/console-utils/xconsole-service/src/interceptors/consoleInterceptor/response.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
/* eslint-disable @typescript-eslint/no-throw-literal */
2+
import qs from 'qs';
23
import { IError, IResponse, IResponseData } from '../../types';
34
import { ApiType } from '../../const/index';
45
import { AxiosResponse } from 'axios';
56

67
const injectErrorPromptAdaptor = (error: IError, response: AxiosResponse) => {
8+
let body = {};
9+
try {
10+
body = qs.parse(response?.config?.data)
11+
} catch (e){
12+
// nothing
13+
}
714
error.response = response;
815
error.code = response.data?.code;
916
error.requestId = response.data?.requestId;
1017
error.message = response.data?.message;
1118
error.details = {
1219
url: response?.config?.url,
13-
body: response?.config?.data,
20+
body: body,
1421
method: response?.config?.method
1522
}
1623
};

packages/ui/xconsole-error-center/src/errorPrompt2/ErrorPrompt2.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const processError = (errorConfig: Partial<ErrorCodeConfig>, error: ResponseErro
5656
url: error?.response?.config.url,
5757
method: error?.response?.config?.method,
5858
params: error?.response?.config?.params,
59+
...(error?.details || {})
5960
},
6061
code: error?.response?.data?.code,
6162
stack: error.stack,

packages/ui/xconsole-error-center/src/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export interface BaseResponse<T> {
6161

6262
export interface ResponseError<T = any> extends Error {
6363
response?: AxiosResponse<BaseResponse<T>>;
64+
details: any;
6465
}
6566

6667
export type GetMessageCallback = (code: string, msg: string, error: ResponseError) => string;

packages/xconsole/xconsole.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"2.3.41"}
1+
{"version":"2.3.45"}

0 commit comments

Comments
 (0)