From a1eec4e02cb9e87df58b26f3995d91460ced5e36 Mon Sep 17 00:00:00 2001 From: Yangshun Date: Tue, 12 Aug 2025 16:03:17 +0800 Subject: [PATCH] [web] auth/error: don't return to current page for error screens --- apps/web/src/components/auth/AuthLoginError.tsx | 2 +- apps/web/src/hooks/user/useAuthFns.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/auth/AuthLoginError.tsx b/apps/web/src/components/auth/AuthLoginError.tsx index 84b32c1f8..7b15aded9 100644 --- a/apps/web/src/components/auth/AuthLoginError.tsx +++ b/apps/web/src/components/auth/AuthLoginError.tsx @@ -17,7 +17,7 @@ type Props = Readonly<{ export default function AuthLoginError({ code, description }: Props) { const errorContent = useErrorMessages(); const intl = useIntl(); - const { signInUpHref } = useAuthSignInUp(); + const { signInUpHref } = useAuthSignInUp(false); const { message: errorMessage, name: errorName } = errorContent[code ?? ''] || {}; diff --git a/apps/web/src/hooks/user/useAuthFns.ts b/apps/web/src/hooks/user/useAuthFns.ts index 6dad99497..82cdfda2b 100644 --- a/apps/web/src/hooks/user/useAuthFns.ts +++ b/apps/web/src/hooks/user/useAuthFns.ts @@ -15,7 +15,7 @@ type AuthHrefProps = Readonly<{ query?: ParsedUrlQueryInput; }>; -export function useAuthSignInUp() { +export function useAuthSignInUp(returnToCurrentPage = true) { const [signedInBefore] = useAuthSignedInBefore(); const intl = useIntl(); const router = useI18nRouter(); @@ -40,7 +40,7 @@ export function useAuthSignInUp() { return url.format({ pathname: signedInBefore ? '/login' : '/sign-up', query: { - ...(finalNext ? { next: finalNext } : {}), + ...(returnToCurrentPage && finalNext ? { next: finalNext } : {}), ...query, }, });