Hello guys, i read the articles before with similiar names, couldnt figure it out how should i do it for my case. Im suing Pusbullet to send push to my phones, but i can spam the button if i like, but this isn’t good for me. I need to disable the buttons for 10sec, and then enable it again. Can u help me with that?
This is my code:
let apiURL = 'https://api.pushbullet.com/v2/pushes';
let apiKey = 'MyUniqueCode';
function buttonAction(title, body) {
if (apiURL) {
notify('Request has been sent', 'info');
fetch(apiURL, {
method: 'POST',
headers: {
'Access-Token': apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({
'type': 'note',
'title': title,
'body': body
})
})
.then((response) => {
console.log(response)
if (response.ok) {
notify('OK', 'success');
} else {
notify('ERROR', 'error');
}
}).catch((error) => { console.log(error) });
} else {
notify('There is no API URL', 'info');
}
}