diff --git a/frontend/pages/events/[id]/index.vue b/frontend/pages/events/[id]/index.vue index 09f357f93..839473496 100644 --- a/frontend/pages/events/[id]/index.vue +++ b/frontend/pages/events/[id]/index.vue @@ -130,17 +130,27 @@ const windowWidth = ref(window.innerWidth); const handleResize = () => { windowWidth.value = window.innerWidth; - if (window.innerWidth > Breakpoint.SMALL) { - navigateTo(`${id}/about`); - window.removeEventListener("resize", handleResize); + if (windowWidth.value > Breakpoint.SMALL) { + const { locale } = useI18n(); + const currentRoute = useRoute(); + + console.log(`Hey 1: ${currentRoute.path}`); + if ( + currentRoute.path !== `/${locale.value}/events/${id}/about` || + currentRoute.path === `/${locale.value}/events/${id}/` + ) { + navigateTo(`/${locale.value}/events/${id}/about`); + } } }; onMounted(() => { - // Verify that the user is on a mobile device. handleResize(); - // Add event listener to handle resizing. window.addEventListener("resize", handleResize); }); + +onUnmounted(() => { + window.removeEventListener("resize", handleResize); +}); diff --git a/frontend/pages/organizations/[id]/index.vue b/frontend/pages/organizations/[id]/index.vue index 0325970fb..bcbf7d735 100644 --- a/frontend/pages/organizations/[id]/index.vue +++ b/frontend/pages/organizations/[id]/index.vue @@ -158,17 +158,27 @@ const windowWidth = ref(window.innerWidth); const handleResize = () => { windowWidth.value = window.innerWidth; - if (window.innerWidth > Breakpoint.SMALL) { - navigateTo(`${id}/about`); - window.removeEventListener("resize", handleResize); + if (windowWidth.value > Breakpoint.SMALL) { + const { locale } = useI18n(); + const currentRoute = useRoute(); + + console.log(`Hey 1: ${currentRoute.path}`); + if ( + currentRoute.path !== `/${locale.value}/organizations/${id}/about` || + currentRoute.path === `/${locale.value}/organizations/${id}/` + ) { + navigateTo(`/${locale.value}/organizations/${id}/about`); + } } }; onMounted(() => { - // Verify that the user is on a mobile device. handleResize(); - // Add event listener to handle resizing. window.addEventListener("resize", handleResize); }); + +onUnmounted(() => { + window.removeEventListener("resize", handleResize); +});