Skip to content

Commit

Permalink
Menos código duplicado
Browse files Browse the repository at this point in the history
  • Loading branch information
CANCI0 committed Apr 7, 2024
1 parent c6af312 commit 5e5834e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions webapp/src/pages/Bateria/Bateria.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ const JuegoPreguntas = () => {
avgTime: tiempoMedio,
},
};

saveGame("/saveGame");
saveGame("/saveGameList");
};

const saveGame = async (endpoint) => {
try {
const response = await axios.post(URL + '/saveGame', newGame);
const response = await axios.post(URL + endpoint, newGame);
console.log("Solicitud exitosa:", response.data);
} catch (error) {
console.error('Error al guardar el juego:', error);
}
try {
const response = await axios.post(URL + "/saveGameList", newGame);
console.log("Solicitud exitosa:", response.data);
} catch (error) {
console.error("Error al guardar el juego:", error);
}
};
}

const handleSiguientePregunta = async (respuesta) => {
if (respuesta === preguntaActual.correcta) {
Expand Down

0 comments on commit 5e5834e

Please sign in to comment.