Skip to content

Commit

Permalink
chore: new version
Browse files Browse the repository at this point in the history
  • Loading branch information
jjgancfer committed Apr 8, 2024
1 parent 44becd4 commit bb40bfa
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions webapp/src/pages/Game.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default function Game() {
try {
const result = await getCurrentQuestion(gameId);
if (result.status === HttpStatusCode.Ok) {
await setQuestion(result.data);
await setQuestionLoading(false);
setQuestion(result.data);
setQuestionLoading(false);
setTimeElapsed(0);
} else {
navigate("/dashboard");
Expand All @@ -62,18 +62,17 @@ export default function Game() {
const answerButtonClick = async (optionIndex, answer) => {
const selectedOptionIndex = selectedOption === optionIndex ? null : optionIndex;
setSelectedOption(selectedOptionIndex);
await setAnswer(answer);
const anyOptionSelected = selectedOptionIndex !== null;
setNextDisabled(!anyOptionSelected);
setAnswer(answer);
setNextDisabled(false);
};

const startNewRound = async (gameId) => {
try{
console.log("pepe");
const result = await startRound(gameId);
setTimeStartRound(new Date(result.data.round_start_time).getTime());
setRoundNumber(result.data.actual_round )
setRoundDuration(result.data.round_duration);
setNextDisabled(true);
await assignQuestion(gameId);
}
catch(error){
Expand Down

0 comments on commit bb40bfa

Please sign in to comment.