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
+3 -3
View File
@@ -69,12 +69,12 @@ export default function ProfilePage() {
const [showAllActivity, setShowAllActivity] = useState(false)
const loadProfile = useCallback(async () => {
if (!getToken()) { router.replace('/login'); return }
if (!getToken()) { router.replace('/login?next=%2Fprofile'); return }
setLoading(true)
setLoadError('')
try {
const response = await authFetch(`${getApiBase()}/auth/profile`)
if (response.status === 401) { clearToken(); router.replace('/login'); return }
if (response.status === 401) { clearToken(); router.replace('/login?next=%2Fprofile'); return }
if (!response.ok) throw new Error('Could not load your profile. Please try again.')
const profile = await response.json() as ProfileResponse
setData(profile)
@@ -120,7 +120,7 @@ export default function ProfilePage() {
method: 'PUT', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: email.trim() || null }),
})
if (response.status === 401) { clearToken(); router.replace('/login'); return }
if (response.status === 401) { clearToken(); router.replace('/login?next=%2Fprofile'); return }
if (!response.ok) throw new Error(await responseMessage(response, 'Could not save your email. Please try again.'))
const result = await response.json()
const saved = typeof result.email === 'string' ? result.email : ''