From 3398d2ee95b270f2ef661a5020e9a5d1852bb43f Mon Sep 17 00:00:00 2001 From: Suraj Karambe Date: Tue, 12 Sep 2023 20:41:59 +0530 Subject: [PATCH] Moved existing acount success logic on load for invite registration --- .../ChangePasswordDialog/ChangePasswordDialog.tsx | 2 -- .../RegistrationWorkflow/RegistrationWorkflow.tsx | 12 ++++++++++++ login-workflow/src/screens/EulaScreen/EulaScreen.tsx | 12 ++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx b/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx index 408f1aea..c3465c7c 100644 --- a/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx +++ b/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx @@ -47,7 +47,6 @@ export const ChangePasswordDialog: React.FC = (props) previousLabel = t('bluiCommon:ACTIONS.BACK'), nextLabel = t('bluiCommon:ACTIONS.OKAY'), onPrevious, - onSubmit, onFinish, PasswordProps, ErrorDialogProps, @@ -88,7 +87,6 @@ export const ChangePasswordDialog: React.FC = (props) actions, setIsLoading, setShowErrorDialog, - onSubmit, onFinish, props.showSuccessScreen, ]); diff --git a/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx b/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx index 9d6f4b53..857b8cef 100644 --- a/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx +++ b/login-workflow/src/components/RegistrationWorkflow/RegistrationWorkflow.tsx @@ -166,6 +166,18 @@ export const RegistrationWorkflow: React.FC => { + try { + isAccExist = await actions.validateUserRegistrationRequest(params.code, params.email); + } catch (_error) { + triggerError(_error as Error); + } finally { + setIsAccountExist(isAccExist); + setShowSuccessScreen(isAccExist); + } + })(); + updateScreenData({ screenId: 'CreateAccount', values: { emailAddress: params.email } }); updateScreenData({ screenId: 'VerifyCode', values: { code: params.code } }); } diff --git a/login-workflow/src/screens/EulaScreen/EulaScreen.tsx b/login-workflow/src/screens/EulaScreen/EulaScreen.tsx index d0dae5d5..6d423357 100644 --- a/login-workflow/src/screens/EulaScreen/EulaScreen.tsx +++ b/login-workflow/src/screens/EulaScreen/EulaScreen.tsx @@ -36,7 +36,7 @@ export const EulaScreen: React.FC = (props) => { }, }; const regWorkflow = useRegistrationWorkflowContext(); - const { nextScreen, previousScreen, screenData, currentScreen, totalScreens, isInviteRegistration } = regWorkflow; + const { nextScreen, previousScreen, screenData, currentScreen, totalScreens } = regWorkflow; const { WorkflowCardHeaderProps, WorkflowCardActionsProps, @@ -79,24 +79,16 @@ export const EulaScreen: React.FC = (props) => { if (screenData.Eula.accepted) { await actions.acceptEula?.(); } - let isAccExist; - if (isInviteRegistration) { - isAccExist = await actions.validateUserRegistrationRequest( - screenData.VerifyCode.code, - screenData.CreateAccount.emailAddress - ); - } void nextScreen({ screenId: 'Eula', values: { accepted: screenData.Eula.accepted }, - isAccountExist: isAccExist, }); } catch (_error) { triggerError(_error as Error); } finally { setIsLoading(false); } - }, [actions, nextScreen, triggerError, isInviteRegistration, screenData]); + }, [actions, nextScreen, triggerError, screenData]); const onPrevious = useCallback((): void => { setIsLoading(true);