From 1c8febf4b76e9a8f545ceda43f8952c69909a71f Mon Sep 17 00:00:00 2001 From: itsrubberduck Date: Fri, 19 Jun 2026 12:55:12 +0200 Subject: [PATCH] fix(pm): preserve redirect when sending logged-out users to login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unauthenticated /pm visits pushed to /login without a redirect query, so after sign-in they landed on the classroom fallback instead of returning to /pm. Pass route.fullPath as ?redirect= so the bridge link (incl. ?token=…) survives the login round-trip. Co-Authored-By: Claude Opus 4.8 --- app/pages/pm.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/pages/pm.vue b/app/pages/pm.vue index fcd1850..9e54735 100644 --- a/app/pages/pm.vue +++ b/app/pages/pm.vue @@ -2497,12 +2497,19 @@ const scheduleAirportDataRefresh = () => { }, delay) } +// Send unauthenticated visitors to login while preserving where they were +// headed (e.g. /pm?token=… so the bridge link survives the round-trip), +// instead of dropping them on the classroom fallback after sign-in. +const redirectToLogin = () => { + router.push({ path: '/login', query: { redirect: route.fullPath } }) +} + onMounted(async () => { try { if (!auth.accessToken) { const refreshed = await auth.tryRefresh() if (!refreshed) { - router.push('/login') + redirectToLogin() return } } @@ -2510,7 +2517,7 @@ onMounted(async () => { if (!auth.user) { await auth.fetchUser().catch((err) => { console.error('Session initialisation failed', err) - router.push('/login') + redirectToLogin() }) } @@ -2568,7 +2575,7 @@ watch( (token) => { if (!token) { persistSelectedPlan(null) - router.push('/login') + redirectToLogin() } } )