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