Improve error when login fails

This commit is contained in:
Midgard 2022-06-08 17:33:16 +02:00
parent bfe52fbbca
commit 38a3bec0a4
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -30,7 +30,11 @@ function logIn() {
.catch(error => {
console.error(error);
buttonEnable(byId("login_button"));
if (error.xhr && error.xhr.responseJson && error.xhr.responseJson.message) {
byId("login_message").innerText = `Error: ${error.xhr.responseJson.message}`;
} else {
byId("login_message").innerText = `${error}`;
}
});
}