Balance system

i want too create some balance system like steam. this page and this button is about to submit amount of money that picked. then i querying the data and get the current balance and add that picket amount

export function button8_click(event) {
wixData.query(“Library”)
.eq(“_id”, $w(‘#text25’).text)
.limit(1)
.find()
.then((results) => {

let firstItem = results.items[0];

let balance = firstItem.balance

            console.log(balance) 

var funds = +balance + +$w(‘#dropdown1’).value;

let toUpdate = {
“_id”: “$w(‘#text25’).text”,
“balance”: funds
};

        wixData.update("Library", toUpdate) 
            .then((res) => { 

let item = res; //see item below
console.log(“Funds added”)
})
. catch ((err) => {
let errorMsg = err;
console.log(“nope broo”)
});
})
. catch ((err) => { let errorMsg = err; });
//Add your code for this event here:

}

sadly the code just saying nope broo and the data are not updated…
anyone can help? ill love to say thanks soo muuucchh please help :wink:

Ukaz

1 Like