euchre-live

Euchre web-app for the socially distant family
git clone git://git.alexkarle.com/euchre-live.git
Log | Files | Refs | README | LICENSE

commit 0b63bc2ec8cdda6cbd1dc92e3dc6ff69dabadfdb (patch)
parent 7f98d29fec3ded13bed09084da7455fadbf1a0ad
Author: Alex Karle <alex@karle.co>
Date:   Sun, 29 Mar 2020 23:51:56 -0400

Dealer: Fix send_error response json

A silly typo here meant I was just sending back the error string, not
the actual object...

Diffstat:
Mlib/Euchre/Dealer.pm | 2+-
Mpublic/debug.html | 10+++++++---
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm @@ -215,7 +215,7 @@ sub send_error { my ($cid, $msg) = @_; my $ws = $PLAYERS{$cid}->{ws}; my $json = { msg_type => 'error', msg => $msg };; - $ws->send({ json => encode_json($msg) }); + $ws->send({ json => encode_json($json) }); } 1; diff --git a/public/debug.html b/public/debug.html @@ -11,9 +11,10 @@ ws.onmessage = function (event) { msg = JSON.parse(JSON.parse(event.data)); // double parsed? console.log(msg) - document.body.innerHTML += '<br>Game: ' + msg.game.id + '<br>' - document.body.innerHTML += 'Players: ' + msg.game.players + '<br>' - document.body.innerHTML += 'Spectators: ' + msg.game.spectators + '<br>' + gameState = '<br>Game: ' + msg.game.id + '<br>' + + 'Players: ' + msg.game.players + '<br>' + + 'Spectators: ' + msg.game.spectators + '<br>' + document.getElementById('game').innerHTML = gameState }; function joinGame() { @@ -43,5 +44,8 @@ <label for="seat_no">Seat:</label> <input type="number" id="seat_no"> <button onclick="sit()">Sit</button> + + <div id="game"> + </div> </body> </html>