From 667e261096d60a6be13f45f9e5a2903de8f62a34 Mon Sep 17 00:00:00 2001 From: uo293758 Date: Sun, 9 Mar 2025 12:29:35 +0100 Subject: [PATCH] =?UTF-8?q?Eliminaci=C3=B3n=20de=20instrucciones=20de=20de?= =?UTF-8?q?puraci=C3=B3n=20+=20documentaci=C3=B3n=20de=20m=C3=A9todo=20get?= =?UTF-8?q?NextQuestion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gatewayservice/gateway-service.js | 1 - webapp/src/components/game/Game.js | 8 -------- webapp/src/services/GameService.js | 6 +++++- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 2c594357..59a336a0 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -63,7 +63,6 @@ app.post('/askllm', async (req, res) => { app.get('/api/questions', async (req, res) => { const gameSession = new GameSession.default("user123", ["geography", "history"], "easy"); const question = await gameSession.playQuestions(); - console.log("Respuestas:", question) if (question) { res.json(question); } else { diff --git a/webapp/src/components/game/Game.js b/webapp/src/components/game/Game.js index fb94ee93..b0b2da86 100644 --- a/webapp/src/components/game/Game.js +++ b/webapp/src/components/game/Game.js @@ -74,14 +74,6 @@ export const Game = () => { askForNextQuestion(); }, []); // Empty dependency array means this effect runs only once on mount - useEffect(() => { - console.log("Pregunta actualizada:", question); - }, [question]); // Ver el valor de 'question' cuando cambia - - useEffect(() => { - console.log("Respuestas actualizadas:", answers); - }, [answers]); // Ver el valor de 'answers' cuando cambia - /** * Handles the popstate event to prevent the user from navigating back */ diff --git a/webapp/src/services/GameService.js b/webapp/src/services/GameService.js index 0b8ec683..18f80892 100644 --- a/webapp/src/services/GameService.js +++ b/webapp/src/services/GameService.js @@ -2,10 +2,14 @@ import axios from 'axios'; const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; + /** + * Function to calll the API endpoint to get the next question + * + * @returns {Promise<{question: {text: string, image: string, topic: string}, answers: {text: string, isCorrect: boolean}[]>} + */ const getNextQuestion = async () => { try { const response = await axios.get(apiEndpoint + '/api/questions'); - console.log("Respuesta obtenida: ", response.data); const fullStructure = { question: {