Skip to content

Commit

Permalink
toastMsg: Fixed empty toast message when player tries to join game wi…
Browse files Browse the repository at this point in the history
…th wrong code

Fixes: #147
sethdivyansh authored and kuv2707 committed Jun 23, 2024
1 parent 59a2f30 commit cb86075
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/controllers/gameControllers.ts
Original file line number Diff line number Diff line change
@@ -12,13 +12,13 @@ export async function handleGameJoin(req: AuthRequest, res: Response) {
const activeGameId = req.user.activeGameId;
if (activeGameId) {
res.status(400).send({
message: 'User is already playing a game',
error: 'User is already playing a game',
});
return;
}
const game = retrieveGame(gameCode);
if (!game) {
res.status(404).send({ message: 'Game not found' });
res.status(404).send({ error: 'Game not found' });
return;
}
//note: when retrieving game from database, it is not an instance of GameEngine
@@ -47,7 +47,7 @@ export async function handleGameCreate(req: AuthRequest, res: Response) {
playerId: req.user.id as string,
});
if (eventResult.type === 'ERROR') {
res.status(500).send({ message: 'Failed to create game' });
res.status(500).send({ error: 'Failed to create game' });
return;
}
req.user.activeGameId = game.id;

0 comments on commit cb86075

Please sign in to comment.