server/core/js/maintenance-check.js
Christoph Wurst 9af69ca2a5
Fix usage of deprecated OC.webroot
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2018-10-09 13:53:59 +02:00

17 lines
493 B
JavaScript

// Check every 20 seconds via status.php if maintenance is over
window.setInterval(checkStatus, 20000);
function checkStatus() {
var request = new XMLHttpRequest();
request.open("GET", OC.getRootPath()+'/status.php', true);
request.onreadystatechange = function() {
if (request.readyState === 4) {
var response = request.responseText;
var responseobj = JSON.parse(response);
if (responseobj.maintenance === false) {
window.location.reload();
}
}
};
request.send();
}