feat(slots): update balance handling on spin results

This commit is contained in:
Jan-Marlon Leibl 2025-05-07 17:47:34 +02:00
commit a3f34e960b
Signed by: jleibl
GPG key ID: 300B2F906DC6F1D5
2 changed files with 7 additions and 3 deletions

View file

@ -109,17 +109,20 @@ export default class SlotsComponent implements OnInit, OnDestroy {
next: (result) => {
setTimeout(() => {
this.slotResult.set(result);
if (result.status === 'win') {
this.userService.updateLocalBalance(result.amount);
}
this.userService.refreshCurrentUser();
this.isSpinning = false;
}, 1500);
},
error: (err) => {
console.error('Error spinning slot machine:', err);
this.userService.updateLocalBalance(betAmount);
this.userService.refreshCurrentUser();
this.isSpinning = false;
},
});