Skip to content

Commit 4a70373

Browse files
committed
Add error msg in notification
Add the API response error message in the frontend notification box. Signed-off-by: Xichen Pan <xichen.pan@gmail.com>
1 parent ab4b60f commit 4a70373

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/api-engine/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Jinja2==2.11.3
2727
jsonpointer==2.0
2828
jsonschema==3.2.0
2929
kubernetes==11.0.0
30-
MarkupSafe==1.1.1
30+
MarkupSafe==2.0.1
3131
oauthlib==3.1.0
3232
packaging==20.4
3333
pathtools==0.1.2

src/dashboard/src/utils/request.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import { extend } from 'umi-request';
23
import { notification } from 'antd';
34
import { history } from 'umi';
@@ -25,8 +26,13 @@ const codeMessage = {
2526
* 异常处理程序
2627
*/
2728
const errorHandler = error => {
28-
const { response = {} } = error;
29-
const errortext = codeMessage[response.status] || response.statusText;
29+
const { response, data } = error;
30+
const errortext = (
31+
<>
32+
{codeMessage[response.status] || response.statusText} <br />
33+
{data.msg[0]}
34+
</>
35+
);
3036
const { status, url } = response;
3137
let verifyUserFail = false;
3238

0 commit comments

Comments
 (0)