Skip to content

Commit

Permalink
Merge pull request #594 from xichen1/notification-err
Browse files Browse the repository at this point in the history
Add error msg in notification
  • Loading branch information
xichen1 authored Feb 24, 2024
2 parents d1957fd + 4116710 commit ca89f9a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dashboard/src/utils/request.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { extend } from 'umi-request';
import { notification } from 'antd';
import { history } from 'umi';
Expand Down Expand Up @@ -25,8 +26,13 @@ const codeMessage = {
* 异常处理程序
*/
const errorHandler = error => {
const { response = {} } = error;
const errortext = codeMessage[response.status] || response.statusText;
const { response, data } = error;
const errortext = (
<>
{codeMessage[response.status] || response.statusText} <br />
{data && data.msg && Array.isArray(data.msg) && data.msg.length > 0 && data.msg[0]}
</>
);
const { status, url } = response;
let verifyUserFail = false;

Expand Down

0 comments on commit ca89f9a

Please sign in to comment.