mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 22:49:32 -02:30
handle error string in FormSubmitError
This commit is contained in:
@@ -39,8 +39,13 @@ function FormSubmitError({ error }) {
|
|||||||
const errorMessages = {};
|
const errorMessages = {};
|
||||||
Object.keys(error.response.data).forEach(fieldName => {
|
Object.keys(error.response.data).forEach(fieldName => {
|
||||||
const errors = error.response.data[fieldName];
|
const errors = error.response.data[fieldName];
|
||||||
if (errors && errors.length) {
|
if (!errors) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Array.isArray(errors.length)) {
|
||||||
errorMessages[fieldName] = errors.join(' ');
|
errorMessages[fieldName] = errors.join(' ');
|
||||||
|
} else {
|
||||||
|
errorMessages[fieldName] = errors;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setErrors(errorMessages);
|
setErrors(errorMessages);
|
||||||
|
|||||||
Reference in New Issue
Block a user