diff --git a/packages/ui/src/hooks/use-social-register.ts b/packages/ui/src/hooks/use-social-register.ts index 6f0ad6c9e..2cbd60235 100644 --- a/packages/ui/src/hooks/use-social-register.ts +++ b/packages/ui/src/hooks/use-social-register.ts @@ -5,8 +5,11 @@ import { registerWithVerifiedSocial } from '@/apis/interaction'; import useApi from './use-api'; import useRequiredProfileErrorHandler from './use-required-profile-error-handler'; -const useSocialRegister = (connectorId?: string) => { - const requiredProfileErrorHandlers = useRequiredProfileErrorHandler({ linkSocial: connectorId }); +const useSocialRegister = (connectorId?: string, replace?: boolean) => { + const requiredProfileErrorHandlers = useRequiredProfileErrorHandler({ + linkSocial: connectorId, + replace, + }); const { result: registerResult, run: asyncRegisterWithSocial } = useApi( registerWithVerifiedSocial, diff --git a/packages/ui/src/hooks/use-social-sign-in-listener.ts b/packages/ui/src/hooks/use-social-sign-in-listener.ts index 6dac0f352..4ed550b11 100644 --- a/packages/ui/src/hooks/use-social-sign-in-listener.ts +++ b/packages/ui/src/hooks/use-social-sign-in-listener.ts @@ -25,7 +25,7 @@ const useSocialSignInListener = (connectorId?: string) => { const navigate = useNavigate(); - const registerWithSocial = useSocialRegister(connectorId); + const registerWithSocial = useSocialRegister(connectorId, true); const accountNotExistErrorHandler = useCallback( async (error: RequestErrorBody) => { @@ -51,7 +51,10 @@ const useSocialSignInListener = (connectorId?: string) => { [connectorId, navigate, registerWithSocial] ); - const requiredProfileErrorHandlers = useRequiredProfileErrorHandler({ flow: UserFlow.signIn }); + const requiredProfileErrorHandlers = useRequiredProfileErrorHandler({ + replace: true, + flow: UserFlow.signIn, + }); const signInWithSocialErrorHandlers: ErrorHandlers = useMemo( () => ({