web: print log message only if available

This commit is contained in:
Marvin Steadfast 2021-05-04 10:41:18 +02:00
parent 61bd2f41c7
commit c0b7c2b5fd

View File

@ -22,7 +22,9 @@
var source = new EventSource("/log");
source.onmessage = function(event) {
var j = JSON.parse(event.data);
document.getElementById("log").innerHTML += j.message + "<br>";
if (j.hasOwnProperty('message')) {
document.getElementById("log").innerHTML += j.message + "<br>";
}
};
} else {
document.getElementById("log").innerHTML = "Sorry, your browser does not support server-sent events...";