work on unlock button event handler

master
Bryan 2020-12-20 10:51:30 -06:00
parent a88796ff28
commit 361f046118
1 changed files with 2 additions and 2 deletions

View File

@ -302,7 +302,7 @@
const unlockUrl = "https://ths.tnet.space/cgi-bin/unlock-main.cgi"; const unlockUrl = "https://ths.tnet.space/cgi-bin/unlock-main.cgi";
// make fetch function that calls cgi script with attributes (device id, api key, delay) // make fetch function that calls cgi script with attributes (device id, api key, delay)
const unlockDoor = (dID, aK, d) => { const unlockDoor = (e, dID, aK, d) => {
fetch(`${unlockUrl}?deviceID=${dID}&apiKey=${aK}&delay=${d}`) fetch(`${unlockUrl}?deviceID=${dID}&apiKey=${aK}&delay=${d}`)
// fetch(unlockUrl) // fetch(unlockUrl)
.then(response => response.text()) .then(response => response.text())
@ -354,7 +354,7 @@
gotoMainScreen(); gotoMainScreen();
}); });
unlockButton.addEventListener("click", unlockDoor(deviceID, apiKey, 0)); unlockButton.addEventListener("click", (e) => unlockDoor(e, deviceID, apiKey, 0));
delayUnlockButton.addEventListener("click", function () { delayUnlockButton.addEventListener("click", function () {
messageContainer.innerHTML = "Delay Unlock"; messageContainer.innerHTML = "Delay Unlock";