diff --git a/webapp/src/components/Game/Game.tsx b/webapp/src/components/Game/Game.tsx index 58fed46..b86280a 100644 --- a/webapp/src/components/Game/Game.tsx +++ b/webapp/src/components/Game/Game.tsx @@ -59,8 +59,10 @@ export default function Game(props: Props) { setQuestionCount(questionCount+1); setLoading(true); - if(!isNaN(Number((questions[questionCount].answers[0])))) - questions[questionCount].answers = questions[questionCount].answers.map((a) => formatNumberWithDots(a)); + if(!isNaN(Number((questions[questionCount].answers[0])))){ + const newAnswers = questions[questionCount].answers.map((a) => formatNumberWithDots(a)); + questions[questionCount].answers = newAnswers; + } setTimeout(() => { setLoading(false); diff --git a/webapp/src/components/Game/Trivia/TriviaGame.tsx b/webapp/src/components/Game/Trivia/TriviaGame.tsx index c20efd1..fac79a7 100644 --- a/webapp/src/components/Game/Trivia/TriviaGame.tsx +++ b/webapp/src/components/Game/Trivia/TriviaGame.tsx @@ -147,12 +147,14 @@ const getSetColor: (n: number) => SetColorFunction = (n: number) => { const saveAnswer = (answer: string) => { answerSelected.push(answer); - setAnswerSelected(answerSelected); + const newAnswers = [...answerSelected]; + setAnswerSelected(newAnswers); setDiceResult(0); questions.push(questionShowed as questionType); - setQuestions(questions); + const newQuestions = [...questions]; + setQuestions(newQuestions); } diff --git a/webapp/src/components/auth/Login.tsx b/webapp/src/components/auth/Login.tsx index 8e28abb..e6967da 100644 --- a/webapp/src/components/auth/Login.tsx +++ b/webapp/src/components/auth/Login.tsx @@ -24,8 +24,7 @@ const Login = (props:props) => { return; } - const response = login(username, password); - console.log(response); + const response = await login(username, password); if (!response) { setError("Invalid Credentials"); }