Preserve monthly recap destinations through sign-in
Magent CI/CD / verify (push) Successful in 10m36s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Successful in 1m26s

This commit is contained in:
2026-09-09 22:42:58 +12:00
parent 1979e02cde
commit e014baadc3
3 changed files with 21 additions and 4 deletions
+4 -1
View File
@@ -71,7 +71,10 @@ export default function LoginPage() {
if (!data?.authenticated) { setError('Could not sign in. Please try again.'); return }
setToken('cookie')
const next = new URLSearchParams(window.location.search).get('next') || ''
window.location.assign(next === '/insights' || /^\/issues\/confirm\/\d+$/.test(next) ? next : '/welcome')
const allowedNext = ['/insights', '/insights/reports', '/profile', '/profile#monthly-recaps', '/admin/recaps'].includes(next)
|| /^\/insights\/reports\?month=[0-9]{4}-(?:0[1-9]|1[0-2])$/.test(next)
|| /^\/issues\/confirm\/\d+$/.test(next)
window.location.assign(allowedNext ? next : '/welcome')
} catch {
setError('Could not reach Magent. Check your connection and try again.')
} finally { setLoading(false) }