diff --git a/files/assets/js/award_modal.js b/files/assets/js/award_modal.js index e51c60c40..1d7438e0a 100644 --- a/files/assets/js/award_modal.js +++ b/files/assets/js/award_modal.js @@ -152,10 +152,18 @@ function buy(mb) { } function giveaward(t) { + const kind = document.getElementById('kind').value; post_toast_callback(t.dataset.action, { - "kind": document.getElementById('kind').value, + "kind": kind, "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 + } + } ); }