diff --git a/public/app.js b/public/app.js index daabd70..5dd2225 100644 --- a/public/app.js +++ b/public/app.js @@ -11,5 +11,12 @@ import "./components/quantities-crud.js"; import "./components/orders-crud.js"; import "./components/test-panel.js"; import { connectSSE } from "./lib/sse.js"; +import { initRouter } from "./lib/router.js"; connectSSE(); + +// Inicializar router después de que los componentes estén registrados +// Usa setTimeout para asegurar que el DOM esté listo +setTimeout(() => { + initRouter(); +}, 0); diff --git a/public/components/ops-shell.js b/public/components/ops-shell.js index f18e0b7..ab878ba 100644 --- a/public/components/ops-shell.js +++ b/public/components/ops-shell.js @@ -1,10 +1,12 @@ -import { on } from "../lib/bus.js"; +import { emit, on } from "../lib/bus.js"; +import { navigateToView, navigateToItem } from "../lib/router.js"; class OpsShell extends HTMLElement { constructor() { super(); this.attachShadow({ mode: "open" }); this._currentView = "chat"; + this._currentParams = {}; this.shadowRoot.innerHTML = `