[web] auth/error: don't return to current page for error screens

This commit is contained in:
Yangshun 2025-08-12 16:03:17 +08:00
parent bddfee6fbc
commit a1eec4e02c
2 changed files with 3 additions and 3 deletions

View File

@ -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 ?? ''] || {};

View File

@ -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,
},
});