dejar index en historial al cargar automaticmaente pagina

This commit is contained in:
Cat /dev/Nulo 2023-08-28 10:46:21 -03:00
parent 178b9f3c28
commit 964bd059c3

View file

@ -20,29 +20,29 @@ export const currentRoute = writable<{
}>({ component: ChooseWorld });
export let router = navaid("/", () =>
currentRoute.set({ component: NotFound })
currentRoute.set({ component: NotFound }),
);
router.on(routes.ChooseWorld, () =>
currentRoute.set({ component: ChooseWorld })
currentRoute.set({ component: ChooseWorld }),
);
router.on(routes.CreateWorld, () =>
currentRoute.set({ component: CreateWorld })
currentRoute.set({ component: CreateWorld }),
);
router.on(routes.ShareWorld, (params) =>
currentRoute.set({ component: ShareWorld, params })
currentRoute.set({ component: ShareWorld, params }),
);
router.on(routes.JoinWorld, (params) =>
currentRoute.set({ component: JoinWorld, params })
currentRoute.set({ component: JoinWorld, params }),
);
router.on(routes.Page, (params) =>
currentRoute.set({ component: Page, params })
currentRoute.set({ component: Page, params }),
);
async function setRouteToLastPage() {
if (location.pathname === "/") {
const lastPage = await lastPageStore.get();
if (lastPage) {
router.route(inject(routes.Page, lastPage), true);
router.route(inject(routes.Page, lastPage));
}
}
}