Here is the scoreboard
+error
; + + const createGame = async () => { + + const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; + + try { + setPlayers([ + { + username: username, + points: 0, + isBot: false, + } + ]) + const requestData = { + players: [{ + uuid: uuid, + }], + }; + + const response = await axios.post(`${apiEndpoint}/createGame`, requestData); + + const createdGame = response.data; + + setQuestions(createdGame); + console.log('Juego creado:', createdGame); + + + setCurrentStage(1); + return createdGame; + } catch (error) { + console.error('Error al crear el juego:', error); + throw error; + } + }; + + const handlePlayers = (Players:Player[]) => { + return setPlayers(Players); + } + + const handleCurrentStage = (n:number) => { + return setCurrentStage(n); + } + + + return ( +Name: {player.username}
+Total points: {player.points}
+ {player.isBot && } + {!player.isBot && } +{questions[currentQuestion].question}
+You answered {correctAnswers} out of {questions.length} questions correctly.
+You earned {calculatePoints(correctAnswers, questions.length)} points.
+ + > + )} +Username | +Username | +Points | +
---|---|---|
{index+1} | +{score.username} | +{score.points} | +
{t('profile_name')} { user}
+{t('profile_points')} { JSON.stringify(Number(score)) }
+{t('profile_nwins')} { JSON.stringify(Number(nwins)) }
+