diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 919b292..6cd06b8 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -75,16 +75,16 @@ router.beforeEach((to, _from, next) => { return } - // Auto-redirect to mobile layout for mobile devices accessing desktop routes - const onMobile = isMobile() - if (onMobile && to.path === '/' && !to.path.startsWith('/m')) { - next('/m') - return - } - // Desktop user accidentally on mobile route → redirect to desktop - if (!onMobile && to.path.startsWith('/m')) { - next('/') - return + // Auto-redirect: mobile devices hitting root → send to mobile home + // Allow manual override via ?view=desktop or ?view=mobile + const viewOverride = to.query.view as string + if (!viewOverride) { + const onMobile = isMobile() + // Only redirect bare root — explicit paths are honored + if (onMobile && (to.path === '/' || to.path === '')) { + next('/m') + return + } } next()