import _ from "lodash"; import useTranslation from "next-translate/useTranslation"; import Link from "next/link"; import { useRouter } from "next/router"; import React, { useEffect, useState } from "react"; import { connect } from "react-redux"; import { setAccCr, setLogout } from "../../store/accountDetails/action"; import { createAccount, getEmailAccountCheck } from "../../actions"; const RegisterComplete = (props) => { const { footerLinks, pages, handleSubmit, value, setRegisterFormComplete, setAccountCreatedComplete, setAccCr, } = props; let { t, lang } = useTranslation(); const router = useRouter(); const { locale } = router; const [accountCreated, setAccountCreated] = useState(false); useEffect(() => { let accountBody = props.props.props.form.accountRegisterForm.values; let emailAddress = props.props.props.form.accountRegisterForm.values.emailaddress1; // was an appellant "pinswg_typeofinvolvement": 846040001, Object.assign(accountBody, { "pinswg_typeofinvolvement": 846040061, }); accountBody = _.omit(accountBody, ["custom_password_check"]); let checkEmailObj = {}; console.log("props.accountDetails.accCr :", props.accountDetails.accCr); switch (props.accountDetails.accCr) { case "created": case "exists": break; default: let emailExists = getEmailAccountCheck( accountBody.emailaddress1 ).then((data) => { data["@odata.count"] > 0 ? setAccCr("exists") : (checkEmailObj = createAccount(accountBody).then( (data) => { setAccCr("created"); } )); }); break; } }); var registerBody = ""; switch (props.accountDetails.accCr) { case "created": return (registerBody = ( <>
{t("account:register-new-account-confirmation-email")}
{t("account:register-new-account-paragraph-what-next")}
{t("account:register-new-account-paragraph-thanks")}
{t("account:register-new-account-my-portal-link")}
> )); break; case "exists": return (registerBody = ( <>