From 9564ba23e89b0ab77b458b2250a77b854593d91f Mon Sep 17 00:00:00 2001 From: Marco Quintana Date: Thu, 14 Mar 2024 14:15:19 +0100 Subject: [PATCH] Arreglado falta de variables de entorno. Mansi tq --- webapp/src/components/FirstGame.js | 2 +- webapp/src/components/Menu.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/FirstGame.js b/webapp/src/components/FirstGame.js index ece75887..82f31925 100644 --- a/webapp/src/components/FirstGame.js +++ b/webapp/src/components/FirstGame.js @@ -50,7 +50,7 @@ const Quiz = () => { const getQuestions = async () => { try { - const response = await axios.get(`${apiEndpoint}/questions?n_preguntas=${1}`); + const response = await axios.get(`${apiEndpoint}/questions`); console.log(response.data.length) for (var i = 0; i < response.data.length; i++) { var possibleAnswers = [response.data[i].respuesta_correcta, response.data[i].respuestas_incorrectas[0], response.data[i].respuestas_incorrectas[1], response.data[i].respuestas_incorrectas[2]] diff --git a/webapp/src/components/Menu.js b/webapp/src/components/Menu.js index d10ac752..f2d1d9a7 100644 --- a/webapp/src/components/Menu.js +++ b/webapp/src/components/Menu.js @@ -5,7 +5,7 @@ import 'react-circular-progressbar/dist/styles.css'; import axios from 'axios'; import { useNavigate } from 'react-router-dom'; // Importa useHistory -const apiEndpoint = 'http://localhost:8007'; +const apiEndpoint = process.env.REACT_APP_API_ENDPOINT|| 'http://localhost:8000'; var isApiCalledRef = false; @@ -66,7 +66,7 @@ const Menu = () => { const getQuestions = async () => { try { setn_preguntas(5) - const response = await axios.get(`${apiEndpoint}/questions?n_preguntas=${n_preguntas}`); + const response = await axios.get(`${apiEndpoint}/questions`); console.log(response.data.length) for (var i = 0; i < response.data.length; i++) { var possibleAnswers = [response.data[i].respuesta_correcta, response.data[i].respuestas_incorrectas[0], response.data[i].respuestas_incorrectas[1], response.data[i].respuestas_incorrectas[2]]