disable "give award" button when number of owned selected awards goes to 0

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-10-31 23:10:04 +02:00
parent cda0b3592c
commit e3a8f5eda6
1 changed files with 6 additions and 4 deletions

View File

@ -142,8 +142,8 @@ function buy(mb) {
if (success) {
document.getElementById('giveaward').disabled=false;
let owned = document.getElementById(`${kind}-owned`)
let ownednum = Number(owned.textContent);
owned.textContent = ownednum + 1
let ownednum = Number(owned.textContent) + 1;
owned.textContent = ownednum
}
};
@ -161,8 +161,10 @@ function giveaward(t) {
(xhr) => {
if(xhr.status == 200) {
let owned = document.getElementById(`${kind}-owned`)
let ownednum = Number(owned.textContent);
owned.textContent = ownednum - 1
let ownednum = Number(owned.textContent) - 1;
owned.textContent = ownednum
if (ownednum == 0)
document.getElementById('giveaward').disabled=true;
}
}
);