Added fallback for empty error messages.
In the case where the data.errors object does not have any explicit errors, the diff adds a fallback. The resulting error message displayed will then be the general data message. This prevents situations where the user receives an empty error message.
This commit is contained in:
parent
fc7d1bd62f
commit
23b71a09c6
@ -159,6 +159,9 @@
|
|||||||
for (let key in data.errors) {
|
for (let key in data.errors) {
|
||||||
errorMessage += data.errors[key] + '<br>';
|
errorMessage += data.errors[key] + '<br>';
|
||||||
}
|
}
|
||||||
|
if (errorMessage === '') {
|
||||||
|
errorMessage = data.message;
|
||||||
|
}
|
||||||
setError(errorMessage, button);
|
setError(errorMessage, button);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user