update currency values when buying awards from the award modal

pull/136/head
Aevann 2023-02-27 19:49:30 +02:00
parent 2738ae8db7
commit 1c2e865495
1 changed files with 7 additions and 0 deletions

View File

@ -91,7 +91,11 @@ function vote(type, id, dir) {
xhr[0].send(xhr[1]); xhr[0].send(xhr[1]);
} }
let global_price;
function pick(kind, price, coins, marseybux) { function pick(kind, price, coins, marseybux) {
global_price = price;
price = parseInt(price) price = parseInt(price)
coins = parseInt(coins) coins = parseInt(coins)
marseybux = parseInt(marseybux) marseybux = parseInt(marseybux)
@ -146,6 +150,9 @@ function buy(mb) {
let ownednum = Number(owned.textContent) + 1; let ownednum = Number(owned.textContent) + 1;
owned.textContent = ownednum owned.textContent = ownednum
} }
const currency = mb ? "bux" : "coins";
document.getElementById(`user-${currency}-amount`).innerText = parseInt(document.getElementById(`user-${currency}-amount`).innerText) - global_price;
} }
}; };