fix: show the unique row value in the import preview

This commit is contained in:
Ahmed Bouhuolia
2024-03-28 05:38:24 +02:00
parent 8ab809fc71
commit 040f016273
10 changed files with 70 additions and 40 deletions

View File

@@ -32,10 +32,14 @@ export class ImportFileDataValidator {
try {
await YupSchema.validate(_data, { abortEarly: false });
} catch (validationError) {
const errors = validationError.inner.map((error) => ({
errorCode: 'ValidationError',
errorMessage: error.errors,
}));
const errors = validationError.inner.reduce((errors, error) => {
const newErrors = error.errors.map((errMsg) => ({
errorCode: 'ValidationError',
errorMessage: errMsg,
}));
return [...errors, ...newErrors];
}, []);
throw errors;
}
}