Merge pull request #2325 from automatisch/AUT-1436

fix: add check if errors exist in getUnifiedErrorMessage function
This commit is contained in:
Ali BARIN
2025-01-31 14:35:20 +01:00
committed by GitHub
2 changed files with 4 additions and 1 deletions

View File

@@ -134,7 +134,7 @@ function ImportFlowDialog(props) {
severity="error"
sx={{ whiteSpace: 'pre-line' }}
>
{getUnifiedErrorMessage(error.response.data.errors) ||
{getUnifiedErrorMessage(error?.response?.data?.errors) ||
formatMessage('genericError')}
</Alert>
)}

View File

@@ -29,6 +29,9 @@ export const getFieldErrorMessage = ({ fieldName, error }) => {
};
export const getUnifiedErrorMessage = (errors) => {
if (!errors) {
return null;
}
return Object.values(errors)
.flatMap((error) => error)
.join('\n\r');