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:
Leonid Nikitin 2023-11-23 01:10:04 +06:00
parent fc7d1bd62f
commit 23b71a09c6
Signed by: kor-elf
GPG Key ID: 604A019EB118CAC4

View File

@ -159,6 +159,9 @@
for (let key in data.errors) {
errorMessage += data.errors[key] + '<br>';
}
if (errorMessage === '') {
errorMessage = data.message;
}
setError(errorMessage, button);
return
}