26 lines
No EOL
744 B
JavaScript
26 lines
No EOL
744 B
JavaScript
(function () {
|
|
setInterval(function () {
|
|
fetch("/api").then(function (response) {
|
|
return response.json();
|
|
}).then(function (json) {
|
|
let e = document.getElementById("lock-status");
|
|
e.innerText = JSON.stringify(json.locks);
|
|
})
|
|
}, 10000)
|
|
|
|
for (let e of document.querySelectorAll("button.lock-unlock")) {
|
|
e.onclick = function () {
|
|
fetch("/api", {
|
|
method: "POST",
|
|
body: JSON.stringify({
|
|
name: e.name,
|
|
contentType: "application/json",
|
|
})
|
|
}).then(function (response) {
|
|
//
|
|
})
|
|
}
|
|
}
|
|
|
|
console.log("Setup complete")
|
|
})(); |