From 714eefae023e9e5e639b8fd4c5a9b010a947f1ba Mon Sep 17 00:00:00 2001 From: Lara Date: Mon, 8 Apr 2024 23:11:36 +0200 Subject: [PATCH] Quitando comentarios y variables sin usar --- gatewayservice/gateway-service.js | 22 ------------ userservice/userservice/user-service.js | 39 --------------------- webapp/src/components/Pages/Estadisticas.js | 2 +- webapp/src/components/Pages/Juego.js | 1 - 4 files changed, 1 insertion(+), 63 deletions(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 67a6060..51eb962 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -70,28 +70,6 @@ app.get('/updateStats', async (req, res) => { } }); -// app.get('/updateIncorrectAnswers', async (req, res) => { -// const params = {username: req.query.username, numAnswers: req.query.numAnswers}; -// try{ -// const updateStatsResponse = await axios.get(userServiceUrl+ `/updateIncorrectAnswers?params=${params}`) -// res.json(updateStatsResponse.data); -// }catch(error){ -// res.status(error.response.status).json({error: error.response.data.error}); -// } -// }); - -// app.get('/updateCompletedGames', async (req, res) => { -// const { username } = req.query; -// try{ -// const updateStatsResponse = await axios.get(userServiceUrl+ `/updateCompletedGames?username=${username}`) -// res.json(updateStatsResponse.data); -// }catch(error){ -// res.status(error.response.status).json({error: error.response.data.error}); -// } -// }); - - - app.get('/getUserData', async (req, res) => { console.log(req.query) const { username } = req.query; diff --git a/userservice/userservice/user-service.js b/userservice/userservice/user-service.js index 78c2a49..1f8305b 100644 --- a/userservice/userservice/user-service.js +++ b/userservice/userservice/user-service.js @@ -66,26 +66,6 @@ app.get('/updateStats', async (req,res) => { } }) -// app.get('/updateIncorrectAnswers', async (req,res) => { -// console.log(req.query) -// //const { username } = req.query; -// const { username } = req.query.username; -// const { numAnswers } = req.query.numAnswers; -// try { -// const user = await User.findOne({ username }); -// if (!user) { -// return res.status(404).json({ success: false, message: 'Usuario no encontrado' }); -// } -// // Incrementa las respuestas incorrectas del usuario -// user.incorrectAnswers = numAnswers; -// await user.save(); -// return res.status(200).json({ success: true, message: 'Respuestas incorrectas actualizada con éxito' }); -// } catch (error) { -// console.error('Error al actualizar la respuesta correcta:', error); -// return res.status(500).json({ success: false, message: 'Error al actualizar las respuestas incorrectas' }); -// } -// }) - app.get('/getUserData', async (req, res) => { const { username } = req.query; try { @@ -100,25 +80,6 @@ app.get('/getUserData', async (req, res) => { } }); - -// app.get('/updateCompletedGames', async (req,res) => { -// console.log(req.query) -// const { username } = req.query; -// try { -// const user = await User.findOne({ username }); -// if (!user) { -// return res.status(404).json({ success: false, message: 'Usuario no encontrado' }); -// } -// user.completedGames += 1; -// await user.save(); -// return res.status(200).json({ success: true, message: 'Juegos completados actualizado con éxito' }); -// } catch (error) { -// console.error('Error al actualizar Juegos completados:', error); -// return res.status(500).json({ success: false, message: 'Error al actualizar Juegos completados' }); -// } -// }) - - const server = app.listen(port, () => { console.log(`User Service listening at http://localhost:${port}`); }); diff --git a/webapp/src/components/Pages/Estadisticas.js b/webapp/src/components/Pages/Estadisticas.js index 72562a0..244a24d 100644 --- a/webapp/src/components/Pages/Estadisticas.js +++ b/webapp/src/components/Pages/Estadisticas.js @@ -1,6 +1,6 @@ // src/components/Login.js import React, { useState, useEffect } from 'react'; -import { Container, Typography, TextField, Button, Snackbar } from '@mui/material'; +import { Container } from '@mui/material'; import '../Estilos/estadisticas.css'; import axios from 'axios'; diff --git a/webapp/src/components/Pages/Juego.js b/webapp/src/components/Pages/Juego.js index f203064..4dc2a68 100644 --- a/webapp/src/components/Pages/Juego.js +++ b/webapp/src/components/Pages/Juego.js @@ -4,7 +4,6 @@ import axios from 'axios'; import '../Estilos/juego.css'; import { Container } from '@mui/material'; import Temporizador from '../Temporizador'; -import { jwtDecode } from 'jwt-decode'; const Juego = ({isLogged, username, numPreguntas}) => { //La pregunta (string)