fixes to fetch functions
parent
a4867b7188
commit
12e64aeff7
|
|
@ -24,8 +24,10 @@
|
||||||
const unlockDoor = (e, 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}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => setTimeout(function() {messageContainer.innerHTML = ""}, 3000);
|
.then(data => () {
|
||||||
messageContainer.innerHTML = data.message)
|
setTimeout(function() { messageContainer.innerHTML = "" }, 3000);
|
||||||
|
messageContainer.innerHTML = data.message;
|
||||||
|
})
|
||||||
.catch(error => messageContainer.innerHTML = `Error: ${error}`)
|
.catch(error => messageContainer.innerHTML = `Error: ${error}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue