fix code navigation

This commit is contained in:
Valentin 2024-11-14 04:33:27 +01:00
parent 31b577cc8b
commit 9370996c03
1 changed files with 2 additions and 13 deletions

View File

@ -23,18 +23,7 @@ export function handleClickableElements(clickableElements, store, router, baseUr
link.onclick = async function (e) { link.onclick = async function (e) {
router.push(href); router.push(href);
if (href !== window.location.pathname) { if (href !== window.location.pathname) {
if (href === '/') { pageChange(href, store, siteName, mapStore, baseUrl);
store.resetStore(true);
document.title = siteName;
mapStore.resetMap();
} else {
await store.fetchContentData(baseUrl + href);
document.title = store.pageTitle;
}
setActiveNavItem(store.contentType, href);
const listeEtape = document.querySelector('#etapes-liste');
if (!useLayoutStore().isDesktop) useLayoutStore().collapseEtapeListe(listeEtape);
} }
} }
} }
@ -46,7 +35,7 @@ export async function handleBrowserNavigation(store, baseUrl, siteName, mapStore
pageChange(href, store, siteName, mapStore, baseUrl) pageChange(href, store, siteName, mapStore, baseUrl)
} }
async function pageChange(href, store, siteName, mapStore, baseUrl ) { async function pageChange(href, store, siteName, mapStore, baseUrl) {
if (href === '/') { if (href === '/') {
store.resetStore(true); store.resetStore(true);
document.title = siteName; document.title = siteName;