diff --git a/frontend/src/api/user/signup.ts b/frontend/src/api/user/signup.ts index c91442dbf6..09aabebf61 100644 --- a/frontend/src/api/user/signup.ts +++ b/frontend/src/api/user/signup.ts @@ -14,7 +14,6 @@ const signup = async ( const response = await axios.post(`/register`, { ...props, }); - console.log(' response.data.data', response.data.data); return { statusCode: 200, error: null, diff --git a/frontend/src/pages/SignUp/SignUp.tsx b/frontend/src/pages/SignUp/SignUp.tsx index 19288e2cd3..f102c8f97d 100644 --- a/frontend/src/pages/SignUp/SignUp.tsx +++ b/frontend/src/pages/SignUp/SignUp.tsx @@ -81,6 +81,13 @@ function SignUp({ version }: SignUpProps): JSX.Element { form.setFieldValue('organizationName', responseDetails.organization); setIsDetailsDisable(true); } + }, [ + getInviteDetailsResponse.data?.payload, + form, + getInviteDetailsResponse.status, + ]); + + useEffect(() => { if ( getInviteDetailsResponse.status === 'success' && getInviteDetailsResponse.data?.error @@ -91,19 +98,19 @@ function SignUp({ version }: SignUpProps): JSX.Element { }); } }, [ - getInviteDetailsResponse.data?.payload, - getInviteDetailsResponse.data?.error, + getInviteDetailsResponse.data, getInviteDetailsResponse.status, - getInviteDetailsResponse, notifications, - form, ]); const isPreferenceVisible = token === null; const commonHandler = async ( values: FormValues, - callback: (e: SuccessResponse) => Promise | VoidFunction, + callback: ( + e: SuccessResponse, + values: FormValues, + ) => Promise | VoidFunction, ): Promise => { try { const { organizationName, password, firstName, email } = values; @@ -129,7 +136,7 @@ function SignUp({ version }: SignUpProps): JSX.Element { payload.refreshJwt, ); if (userResponse) { - callback(userResponse); + callback(userResponse, values); } } else { notifications.error({ @@ -150,16 +157,12 @@ function SignUp({ version }: SignUpProps): JSX.Element { const onAdminAfterLogin = async ( userResponse: SuccessResponse, + values: FormValues, ): Promise => { - const { - organizationName, - isAnonymous, - hasOptedUpdates, - } = form.getFieldsValue(); const editResponse = await editOrg({ - isAnonymous, - name: organizationName, - hasOptedUpdates, + isAnonymous: values.isAnonymous, + name: values.organizationName, + hasOptedUpdates: values.hasOptedUpdates, orgId: userResponse.payload.orgId, }); if (editResponse.statusCode === 200) {