From 1ad2493eabec8da5cbb8667aab1d659e917aa8f9 Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 8 Aug 2023 20:06:03 +0300 Subject: [PATCH] better gambling error messages --- files/assets/js/casino/blackjack_screen.js | 4 ++-- files/assets/js/casino/game_screen.js | 2 +- files/assets/js/casino/roulette_screen.js | 2 +- files/assets/js/casino/slots_screen.js | 6 +++--- files/assets/js/lottery.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/assets/js/casino/blackjack_screen.js b/files/assets/js/casino/blackjack_screen.js index 55f9ffdf2..762b37d3f 100644 --- a/files/assets/js/casino/blackjack_screen.js +++ b/files/assets/js/casino/blackjack_screen.js @@ -14,7 +14,7 @@ function handleBlackjackResponse(xhr) { const succeeded = xhr.status >= 200 && xhr.status < 300 && response && - !response.error; + !response.details; clearResult(); status = xhr.status; @@ -28,7 +28,7 @@ function handleBlackjackResponse(xhr) { updateFeed(response.feed); updatePlayerCurrencies(response.gambler); } else { - console.error("Error: ", response.error); + console.error("Error: ", response.details); throw new Error("Error") } } catch (error) { diff --git a/files/assets/js/casino/game_screen.js b/files/assets/js/casino/game_screen.js index c937a8b56..48c69c700 100644 --- a/files/assets/js/casino/game_screen.js +++ b/files/assets/js/casino/game_screen.js @@ -109,7 +109,7 @@ function handleFeedResponse(xhr) { } const succeeded = - xhr.status >= 200 && xhr.status < 300 && response && !response.error; + xhr.status >= 200 && xhr.status < 300 && response && !response.details; if (succeeded) { document.getElementById("casinoGameFeed").dataset.feed = JSON.stringify(response.feed); diff --git a/files/assets/js/casino/roulette_screen.js b/files/assets/js/casino/roulette_screen.js index b82b5bff0..ed229abbb 100644 --- a/files/assets/js/casino/roulette_screen.js +++ b/files/assets/js/casino/roulette_screen.js @@ -364,7 +364,7 @@ function handleRouletteResponse(xhr) { } const succeeded = - xhr.status >= 200 && xhr.status < 300 && response && !response.error; + xhr.status >= 200 && xhr.status < 300 && response && !response.details; if (succeeded) { buildRouletteBets(response.bets); diff --git a/files/assets/js/casino/slots_screen.js b/files/assets/js/casino/slots_screen.js index 859512bc6..f39072132 100644 --- a/files/assets/js/casino/slots_screen.js +++ b/files/assets/js/casino/slots_screen.js @@ -30,7 +30,7 @@ function handleSlotsResponse(xhr) { } const succeeded = - xhr.status >= 200 && xhr.status < 300 && response && !response.error; + xhr.status >= 200 && xhr.status < 300 && response && !response.details; if (succeeded) { const { game_state, gambler } = response; @@ -58,8 +58,8 @@ function handleSlotsResponse(xhr) { updatePlayerCurrencies(gambler); reloadFeed() } else { - updateResult(response.error, "danger"); - console.error(response.error); + updateResult(response.details, "danger"); + console.error(response.details); } enableWager(); diff --git a/files/assets/js/lottery.js b/files/assets/js/lottery.js index 490a5ca55..908c54923 100644 --- a/files/assets/js/lottery.js +++ b/files/assets/js/lottery.js @@ -87,7 +87,7 @@ function handleLotteryResponse(xhr, method, callback) { const toastMessage = document.getElementById("lottery-post-error-text"); toastMessage.innerText = - (response && response.error) || "Error, please try again later."; + (response && response.details) || "Error, please try again later."; bootstrap.Toast.getOrCreateInstance(toast).show(); }