src/components/views/PlayWhites.js
// the game of a random user gets fetched
the game of a random user gets fetched
the game of a random user gets fetched
async function fetchGame() {
            await api.get(`users/${userId}/games/blackCards`)
                .then(response => {
                    setBlackCard(response.data.blackCard);
                    setGameId(response.data.gameId)
                })
                .catch(error => {
                    if (error.response.status === 404
                        && error.response.data.message === "There is no black card of another user left") {
                        setBlackCard(null);
                    } else {
                        console.error("Details:", error);
                        alert("Invalid Input:\n " + handleError(error));
                    }
                });
        }
async function fetchGame ( ) { await api . get ( ` ${ userId } ` ) . then ( response => { setBlackCard ( response . data . blackCard ) ; setGameId ( response . data . gameId ) } ) . catch ( error => { if ( error . response . status === 404 && error . response . data . message === "There is no black card of another user left" ) { setBlackCard ( null ) ; } else { console . error ( "Details:" , error ) ; alert ( "Invalid Input:\n " + handleError ( error ) ) ; } } ) ; }
the game of a random user gets fetched
the game of a random user gets fetched