Update event emissions.
This commit is contained in:
parent
eeece6ab2f
commit
fe9e272926
1 changed files with 4 additions and 3 deletions
|
|
@ -6,8 +6,8 @@ export default (io: Server, socket: Socket, data: NewHand) => {
|
||||||
|
|
||||||
// Assert game exists
|
// Assert game exists
|
||||||
if (!games[data.game_code]) {
|
if (!games[data.game_code]) {
|
||||||
log.debug(`Can't delete game that doesn't exist: ${data.game_code}`);
|
log.debug(`Can't find game with code: ${data.game_code}`);
|
||||||
socket.emit(`Error`, {
|
socket.emit(`UpdateHand`, {
|
||||||
status: 404,
|
status: 404,
|
||||||
message: `Game with code ${data.game_code} could not be found`,
|
message: `Game with code ${data.game_code} could not be found`,
|
||||||
source: `NewHand`
|
source: `NewHand`
|
||||||
|
|
@ -30,12 +30,13 @@ export default (io: Server, socket: Socket, data: NewHand) => {
|
||||||
team.addCardsToHand(deck.draw(conf.game.hand_size));
|
team.addCardsToHand(deck.draw(conf.game.hand_size));
|
||||||
game.log.silly(`Drew a new hand of cards for team ${data.team}.`);
|
game.log.silly(`Drew a new hand of cards for team ${data.team}.`);
|
||||||
io.to(game.id).emit(`UpdateHand`, {
|
io.to(game.id).emit(`UpdateHand`, {
|
||||||
|
status: 200,
|
||||||
mode: `replace`,
|
mode: `replace`,
|
||||||
questions: team.hand,
|
questions: team.hand,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
socket.emit(`Error`, {
|
socket.emit(`UpdateHand`, {
|
||||||
status: 500,
|
status: 500,
|
||||||
message: `${err.name}: ${err.message}`,
|
message: `${err.name}: ${err.message}`,
|
||||||
source: `NewHand`,
|
source: `NewHand`,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue