1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 06:10:18 +00:00

Added a check for an invalid json format to prevent the UI from crashing. Requests a new reload when the issue is encountered.

This commit is contained in:
Martin Mueller
2022-09-21 15:33:05 -04:00
parent 05ab1734e6
commit fdffb9c041
2 changed files with 119 additions and 104 deletions

13
data/js/controls.js vendored
View File

@ -230,13 +230,24 @@ function start() {
};
websock.onerror = function (evt) {
console.log("websock Error");
console.log(evt);
conStatusError();
};
var handleEvent = function (evt) {
console.log(evt);
var data = JSON.parse(evt.data);
try
{
var data = JSON.parse(evt.data);
}
catch (Event)
{
console.error(Event);
// start the update over again
websock.send("uiok:" + 0);
return;
}
var e = document.body;
var center = "";