Skip to content

Commit

Permalink
Fix rejoin game
Browse files Browse the repository at this point in the history
  • Loading branch information
micschwarz committed Sep 29, 2020
1 parent f3e90a0 commit 6e1d3e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/services/word/OneVsOneWord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export class OneVsOneWord implements MultiplayerWord {
}

const gameData = documentRef.data();
if (gameData.player2 !== null) {

// Rejoin game when already in game
if (gameData.player2 !== null && gameData.player2 !== user.getUid()) {
reject('GAME_ALREADY_FULL');
return;
}
Expand All @@ -103,8 +105,7 @@ export class OneVsOneWord implements MultiplayerWord {

// Rejoin game
if (gameData.player1 === user.getUid()) {
this.resolve(gameData.word);
resolve();
this.listenForJoin(game);
return;
}

Expand Down

0 comments on commit 6e1d3e2

Please sign in to comment.