Skip to content

Commit

Permalink
Eliminación de instrucciones de depuración + documentación de método …
Browse files Browse the repository at this point in the history
…getNextQuestion
  • Loading branch information
JavierSanabriaMiranda committed Mar 9, 2025
1 parent 1abd244 commit 667e261
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 0 additions & 8 deletions webapp/src/components/game/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
6 changes: 5 additions & 1 deletion webapp/src/services/GameService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 667e261

Please sign in to comment.