diff --git a/frontend/wonderloo.html b/frontend/wonderloo.html index ee7181b..6b62853 100644 --- a/frontend/wonderloo.html +++ b/frontend/wonderloo.html @@ -24,18 +24,11 @@ const COLORS = { // ═══════════════════════════════════════════════════════════ // API CONFIG -// En producción el HTML vive bajo el mismo host que /api. -// En dev (localhost o file://) apunta a http://localhost:3001. +// El HTML siempre se sirve detrás de nginx (local: localhost:8080, +// prod: dominio del cliente). nginx hace proxy_pass de /api/ al servicio +// api interno, por eso basta con el mismo origen. // ═══════════════════════════════════════════════════════════ -const API_BASE = (() => { - if (window.location.protocol === "file:" || window.location.origin.includes("localhost")) { - return "http://localhost:3001/api"; - } - return `${window.location.origin}/api`; -})(); - -// Debug — útil para validar que el origin/protocol se resuelven como esperamos -console.log("[wonderloo] origin:", window.location.origin, "protocol:", window.location.protocol, "API_BASE:", API_BASE); +const API_BASE = `${window.location.origin}/api`; async function apiFetch(path, options = {}) { const url = `${API_BASE}${path}`;