diff --git a/frontend/src/@types/dom.d.ts b/frontend/src/@types/dom.d.ts index 49c1fcf..b41a23f 100644 --- a/frontend/src/@types/dom.d.ts +++ b/frontend/src/@types/dom.d.ts @@ -1,19 +1,15 @@ import { type State } from "ft_state"; interface CustomEventMap { - "ft:pageChange": CustomEvent<{}>; + "ft:pageChange": CustomEvent; } declare global { interface Document { //adds definition to Document, but you can do the same with HTMLElement - addEventListener( - type: K, - listener: (this: Document, ev: CustomEventMap[K]) => void, - ): void; - dispatchEvent( - ev: CustomEventMap[K], - ): void; + addEventListener(type: K, + listener: (this: Document, ev: CustomEventMap[K]) => void): void; + dispatchEvent(ev: CustomEventMap[K]): void; } } diff --git a/frontend/src/routing.ts b/frontend/src/routing.ts index 94cd460..4c9d3d4 100644 --- a/frontend/src/routing.ts +++ b/frontend/src/routing.ts @@ -205,9 +205,10 @@ export async function handleRoute() { `/login?returnTo=${encodeURIComponent(window.location.pathname)}`, ); const app = document.getElementById("app")!; - document.dispatchEvent( - new CustomEvent("ft:pageChange" as any, {} as any) as any, - ); + + const event = new CustomEvent("ft:pageChange", { detail: window.location.pathname }); + document.dispatchEvent(event); + let ret = await executeRouteHandler( route_handler, window.location.pathname,