Fixed an undefined in better
This commit is contained in:
parent
1a1cd96b04
commit
08aeae8335
1 changed files with 4 additions and 3 deletions
|
@ -35,15 +35,16 @@
|
||||||
|
|
||||||
async function getBet() {
|
async function getBet() {
|
||||||
let response = await fetch("/api/getCurrentBet");
|
let response = await fetch("/api/getCurrentBet");
|
||||||
if (response.ok) {
|
let data = await response.json();
|
||||||
let data = await response.json();
|
if (response.ok || data.error != null) {
|
||||||
document.getElementById("question").innerText = data.question;
|
document.getElementById("question").innerText = data.question;
|
||||||
outcomes = data.possible;
|
outcomes = data.possible;
|
||||||
document.getElementById("possible").innerText = "Possible outcomes: " + outcomes.join(", ");
|
document.getElementById("possible").innerText = "Possible outcomes: " + outcomes.join(", ");
|
||||||
// noinspection ES6MissingAwait
|
// noinspection ES6MissingAwait
|
||||||
updateTimer(data.timeToBet);
|
updateTimer(data.timeToBet);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("question").innerText = "No bet is currently active";
|
alert("There are no bets currently open");
|
||||||
|
window.location.href = "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue