decrease the number of owned awards when u give one

master
Aevann1 2022-10-19 19:54:18 +02:00
parent 8daa066622
commit 457acd43cb
1 changed files with 10 additions and 2 deletions

View File

@ -152,10 +152,18 @@ function buy(mb) {
} }
function giveaward(t) { function giveaward(t) {
const kind = document.getElementById('kind').value;
post_toast_callback(t.dataset.action, post_toast_callback(t.dataset.action,
{ {
"kind": document.getElementById('kind').value, "kind": kind,
"note": document.getElementById('note').value "note": document.getElementById('note').value
},
(xhr) => {
if(xhr.status == 200) {
let owned = document.getElementById(`${kind}-owned`)
let ownednum = Number(owned.textContent);
owned.textContent = ownednum - 1
}
} }
); );
} }