fix: show cron validation field errors

This commit is contained in:
whyour
2026-08-22 01:20:04 +08:00
parent 134cd8337c
commit 0e975d1d6d
6 changed files with 112 additions and 7 deletions
+6 -6
View File
@@ -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,