diff --git a/web/themes/custom/caravane/assets/js/utils/handle-navigation.js b/web/themes/custom/caravane/assets/js/utils/handle-navigation.js index 4ef6c89..231c762 100644 --- a/web/themes/custom/caravane/assets/js/utils/handle-navigation.js +++ b/web/themes/custom/caravane/assets/js/utils/handle-navigation.js @@ -23,18 +23,7 @@ export function handleClickableElements(clickableElements, store, router, baseUr link.onclick = async function (e) { router.push(href); if (href !== window.location.pathname) { - if (href === '/') { - 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); + pageChange(href, store, siteName, mapStore, baseUrl); } } } @@ -46,7 +35,7 @@ export async function handleBrowserNavigation(store, baseUrl, siteName, mapStore pageChange(href, store, siteName, mapStore, baseUrl) } -async function pageChange(href, store, siteName, mapStore, baseUrl ) { +async function pageChange(href, store, siteName, mapStore, baseUrl) { if (href === '/') { store.resetStore(true); document.title = siteName;