fix: add check if errors exist in getUnifiedErrorMessage function
This commit is contained in:
committed by
Ali BARIN
parent
a0651972ab
commit
b547e98e0c
@@ -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>
|
||||
)}
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user