mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
fix: show the unique row value in the import preview
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user