Plantilla inicial del taller
publicar / publicar (push) Failing after 4s

This commit is contained in:
taller committed 2026-11-22 18:51:36 +00:00
1 parent 421046174b
commit f4f64a76c7
22 files changed
+1157

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
// Web de la votación. Esqueleto: muestra los resultados, pero votar aún no está hecho.
const API = window.API_URL;
async function cargarResultados() {
const caja = document.getElementById("resultados");
try {
const respuesta = await fetch(`${API}/api/resultados`);
const datos = await respuesta.json();
caja.textContent = JSON.stringify(datos);
} catch (error) {
caja.textContent = "No se pueden cargar los resultados (¿está la API en marcha? ¿CORS?)";
}
}
// TODO (equipo web): pintar las opciones de /api/opciones, enviar el voto con POST /api/votos
// y explicar al usuario cada respuesta del contrato (201, 400, 403, 409).
document.getElementById("formulario-voto").addEventListener("submit", (evento) => {
evento.preventDefault();
document.getElementById("mensaje").textContent = "Votar todavía no funciona.";
});
cargarResultados();