work on unlock button event handler
parent
a88796ff28
commit
361f046118
|
|
@ -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";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue