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