%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/containers/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/containers/SignUpPrivateContainer.js |
import { connect } from "react-redux"; // import { withRouter } from "react-router-dom"; import { useLocation, useNavigate, useParams, } from "react-router-dom"; import SignUpPrivate from "components/SignUpPrivateDownloadApp"; import appConfig from "config/countryData"; import { checkExistingUser, checkExistingUserReset, signUp, } from "../actions/api_actions"; import { selectCode, } from "../actions/list_actions"; function withRouter(Component) { function ComponentWithRouterProp(props) { const location = useLocation(); const navigate = useNavigate(); const params = useParams(); return ( // eslint-disable-next-line react/react-in-jsx-scope <Component {...props} router={{ location, navigate, params }} /> ); } return ComponentWithRouterProp; } let countrycode; const mapStateToProps = (state, props) => { countrycode = state.config.toJS().config.countryConstant; const { countryData, checkboxConsentCountries } = appConfig; const signUpFormPrivate = state.form.signUpFormPrivate || null; const showEpHighlight = countrycode ? countryData[countrycode].showSignupEPHighlights : false; const selectedCode = state.user.get("selectedCode"); const checkExistingUserState = state.user.get("checkExistingUser"); const isCheckboxConsentCountry = checkboxConsentCountries.indexOf(countrycode.toLowerCase()) > -1; return { checkExistingUserState, signUpFormPrivate, isCheckboxConsentCountry, config: state.config.toJS(), countryCode: countrycode, countryData, selectedCode, showEpHighlight, showPassword: state.config.get("showPassword"), prefilledPhoneNumber: props?.location?.state?.prefilledPhoneNumber, }; }; const mapDispatchToProps = (dispatch) => ({ checkExistingUser: (phone) => { if (phone === "") { dispatch(checkExistingUserReset()); } else if (phone.length && phone.length > 7) { dispatch( checkExistingUser({ isBusinessFlow: true, phoneNumber: phone, }), ); } }, selectCode: (code) => dispatch(selectCode(code)), signUp: (signData, selectedCode, concentValue, isConcentEnabled) => { const data = signData; const countryCode = countrycode; data.countryCode = countryCode; data.selectedCode = selectedCode; if (isConcentEnabled === true) { data.concentValue = concentValue; } dispatch(signUp(data)); }, }); export default withRouter(connect( mapStateToProps, mapDispatchToProps, )(SignUpPrivate));