Skip to content

Commit

Permalink
Fixed problem with game number of questions if we switch view
Browse files Browse the repository at this point in the history
  • Loading branch information
alegarman2002 committed Apr 29, 2024
1 parent d4c9065 commit f35edf3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion webapp/src/components/FirstGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useLocation, useNavigate } from 'react-router-dom';
import Button from './Button';
import { Footer } from './footer/Footer';
import { Nav } from './nav/Nav';
import {esperar} from './Util';

let currentQuestionIndex = 0;

Expand Down Expand Up @@ -52,6 +51,10 @@ const Quiz = () => {
clearInterval(time);
};
});

const esperar = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
};

function changeButtons(param) {
var borders = document.getElementsByClassName("border");;
Expand Down Expand Up @@ -108,6 +111,7 @@ const Quiz = () => {
haveFailedQuestion = false;
load = true
haveEnter = false
console.log("Calbo")

if (currentQuestionIndex === allQuestions.length ) {
console.log("Entramos aqui")
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/game/GameConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { generateGameId } from '../Util';
const apiEndpoint = process.env.REACT_APP_API_ENDPOINT|| 'http://localhost:8000';

let gameId;
let questions = []

const GameConfiguration = () => {

const GameConfiguration = () => {
let questions = []
const navigation = useNavigate();
let tematicas = ['Paises', 'Capitales'];
let state = useLocation().state;
Expand Down

0 comments on commit f35edf3

Please sign in to comment.