mirror of
https://github.com/whyour/qinglong.git
synced 2026-10-17 07:20:51 +08:00
fix: show cron validation field errors
This commit is contained in:
+6
-6
@@ -9,8 +9,9 @@ import axios, {
|
||||
AxiosResponse,
|
||||
InternalAxiosRequestConfig,
|
||||
} from 'axios';
|
||||
import { getErrorDetails, ValidationErrorResponse } from './httpError';
|
||||
|
||||
export interface IResponseData {
|
||||
export interface IResponseData extends ValidationErrorResponse {
|
||||
code?: number;
|
||||
data?: any;
|
||||
message?: string;
|
||||
@@ -43,6 +44,7 @@ const errorHandler = function (
|
||||
const msg = error.response.data
|
||||
? error.response.data.message || error.message
|
||||
: error.response.statusText;
|
||||
const errorDetails = getErrorDetails(error.response.data);
|
||||
const responseStatus = error.response.status;
|
||||
if ([502, 504].includes(responseStatus)) {
|
||||
history.push('/error');
|
||||
@@ -60,12 +62,10 @@ const errorHandler = function (
|
||||
msg &&
|
||||
notification.error({
|
||||
message: msg,
|
||||
description: error.response?.data?.errors ? (
|
||||
description: errorDetails.length ? (
|
||||
<>
|
||||
{error.response?.data?.errors?.map((item: any) => (
|
||||
<div>
|
||||
{item.message} ({item.value})
|
||||
</div>
|
||||
{errorDetails.map((detail, index) => (
|
||||
<div key={`${index}-${detail}`}>{detail}</div>
|
||||
))}
|
||||
</>
|
||||
) : undefined,
|
||||
|
||||
Reference in New Issue
Block a user