From 23afc4cde3fba818a12b600c3397a1ea7a0163a9 Mon Sep 17 00:00:00 2001 From: Mizanali Panjwani Date: Tue, 23 Feb 2021 20:49:07 +0530 Subject: [PATCH] Error handling improvements --- client/src/components/Game.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/components/Game.js b/client/src/components/Game.js index d8ab02a..f755a09 100644 --- a/client/src/components/Game.js +++ b/client/src/components/Game.js @@ -3,6 +3,7 @@ import PACK_OF_CARDS from '../utils/packOfCards' import shuffleArray from '../utils/shuffleArray' import io from 'socket.io-client' import queryString from 'query-string' +import { Redirect } from 'react-router-dom' //NUMBER CODES FOR ACTION CARDS //SKIP - 404 @@ -706,7 +707,11 @@ const Game = (props) => { {(!roomFull) ? <>

Game Code: {room}

- {users.length===2 ? <> + {users.length===1 && currentUser === 'Player 2' &&

Player 1 has left the game

} + + {users.length===1 && currentUser === 'Player 1' &&

Waiting for Player 2

} + + {users.length===2 && <> {gameOver ?
{winner !== '' && <>

GAME OVER

{winner} wins!

}
:
@@ -776,7 +781,7 @@ const Game = (props) => {
} - :

Waiting for other player

} + } :

Room full

}