dont request status null

This commit is contained in:
daniel-j
2023-12-06 15:11:45 +01:00
parent 72dd30544a
commit 44206e28cb

View File

@@ -62,13 +62,18 @@ function xhr(method, url, cb) {
}
function pollFile () {
if (!key) {
keyOutput.textContent = ''
downloads.style.display = 'none'
return
}
xhr('GET', '/status/' + key, function (x) {
var data
try {
data = JSON.parse(x.responseText)
} catch (err) {
keyOutput.textContent = ''
key = null
keyOutput.textContent = ''
downloads.style.display = 'none'
return
}
@@ -99,8 +104,8 @@ function generateKey () {
if (pollTimer) clearInterval(pollTimer)
pollTimer = setInterval(pollFile, 5 * 1000)
} else {
keyOutput.textContent = ''
key = null
keyOutput.textContent = ''
downloadlink.href = ''
}
keyGenBtn.blur()