Fix 1416
This commit is contained in:
@@ -27,8 +27,8 @@ FROM nginx:1.25-alpine
|
||||
# al directorio por defecto donde Nginx sirve los archivos.
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
# Copiamos nuestra configuración de Nginx para manejar el enrutamiento de la SPA
|
||||
COPY frontend.nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Exponemos el puerto 80 (el puerto por defecto de Nginx).
|
||||
EXPOSE 80
|
||||
|
||||
# El comando por defecto de la imagen de Nginx ya es iniciar el servidor,
|
||||
# así que no necesitamos un CMD o ENTRYPOINT.
|
||||
18
Elecciones-Web/frontend/frontend.nginx.conf
Normal file
18
Elecciones-Web/frontend/frontend.nginx.conf
Normal file
@@ -0,0 +1,18 @@
|
||||
# frontend-admin/frontend.nginx.conf
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|svg|woff|woff2)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
}
|
||||
12
Elecciones-Web/frontend/public/bootstrap.js
vendored
12
Elecciones-Web/frontend/public/bootstrap.js
vendored
@@ -30,7 +30,7 @@
|
||||
// 1. Obtener el manifest.json desde la ruta base detectada
|
||||
const response = await fetch(`${WIDGETS_HOST}/manifest.json`);
|
||||
if (!response.ok) {
|
||||
throw new Error('No se pudo cargar el manifest de los widgets. (404 Not Found)');
|
||||
throw new Error('No se pudo cargar el manifest. (404 Not Found)');
|
||||
}
|
||||
const manifest = await response.json();
|
||||
|
||||
@@ -54,19 +54,9 @@
|
||||
// 4. Cargar el JS principal
|
||||
await loadScript(jsUrl);
|
||||
|
||||
// 5. El addEventListener ya no es necesario aquí, el consumidor lo añade.
|
||||
// Si quiere que sea totalmente automático, puede añadirlo:
|
||||
window.addEventListener('load', function () {
|
||||
if (window.EleccionesWidgets && typeof window.EleccionesWidgets.render === 'function') {
|
||||
window.EleccionesWidgets.render();
|
||||
}
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error al inicializar los widgets de Elecciones:', error);
|
||||
}
|
||||
}
|
||||
|
||||
initWidgets();
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user