mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修改错误提示
This commit is contained in:
parent
a508522872
commit
af97543918
|
@ -159,8 +159,8 @@ export default ({ app }: { app: Application }) => {
|
|||
.status(500)
|
||||
.send({
|
||||
code: 400,
|
||||
message: `${err.name} ${err.message}`,
|
||||
validation: err.errors,
|
||||
message: `${err.message}`,
|
||||
errors: err.errors,
|
||||
})
|
||||
.end();
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@
|
|||
"SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定": "The SMTP login password may also be a special passphrase, depending on the specific email service provider's instructions",
|
||||
"PushMe的Key,https://push.i-i.me/": "PushMe key, https://push.i-i.me/",
|
||||
"自建的PushMeServer消息接口地址,例如:http://127.0.0.1:3010,不填则使用官方消息接口": "The self built PushMeServer message interface address, for example: http://127.0.0.1:3010 If left blank, use the official message interface",
|
||||
"ntfy的url地址,例如 https://ntfy.sh'": "The URL address of ntfy, for example, https://ntfy.sh.",
|
||||
"ntfy的url地址,例如 https://ntfy.sh": "The URL address of ntfy, for example, https://ntfy.sh.",
|
||||
"ntfy的消息应用topic": "The topic for ntfy's messaging application.",
|
||||
"wxPusherBot的appToken": "wxPusherBot's appToken, obtain according to docs https://wxpusher.zjiecode.com/docs/",
|
||||
"wxPusherBot的topicIds": "wxPusherBot's topicIds, at least one of topicIds or uids must be configured",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import intl from 'react-intl-universal';
|
||||
import { message } from 'antd';
|
||||
import { message, notification } from 'antd';
|
||||
import config from './config';
|
||||
import { history } from '@umijs/max';
|
||||
import axios, {
|
||||
|
@ -14,7 +14,7 @@ export interface IResponseData {
|
|||
code?: number;
|
||||
data?: any;
|
||||
message?: string;
|
||||
error?: any;
|
||||
errors?: any[];
|
||||
}
|
||||
|
||||
export type Override<
|
||||
|
@ -41,7 +41,7 @@ const errorHandler = function (
|
|||
) {
|
||||
if (error.response) {
|
||||
const msg = error.response.data
|
||||
? error.response.data.message || error.message || error.response.data
|
||||
? error.response.data.message || error.message
|
||||
: error.response.statusText;
|
||||
const responseStatus = error.response.status;
|
||||
if ([502, 504].includes(responseStatus)) {
|
||||
|
@ -57,9 +57,17 @@ const errorHandler = function (
|
|||
return error.config?.onError(error.response);
|
||||
}
|
||||
|
||||
message.error({
|
||||
content: msg,
|
||||
style: { maxWidth: 500, margin: '0 auto' },
|
||||
notification.error({
|
||||
message: msg,
|
||||
description: (
|
||||
<>
|
||||
{error.response?.data?.errors?.map((item: any) => (
|
||||
<div>
|
||||
{item.message} ({item.value})
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -107,9 +115,15 @@ _request.interceptors.response.use(async (response) => {
|
|||
if (res.code !== 200) {
|
||||
const msg = res.message || res.data;
|
||||
msg &&
|
||||
message.error({
|
||||
content: msg,
|
||||
style: { maxWidth: 500, margin: '0 auto' },
|
||||
notification.error({
|
||||
message: msg,
|
||||
description: (
|
||||
<>
|
||||
{res?.errors.map((item: any) => (
|
||||
<div>{item.message}</div>
|
||||
))}
|
||||
</>
|
||||
),
|
||||
});
|
||||
}
|
||||
return res;
|
Loading…
Reference in New Issue
Block a user