From 48ad5a882364c41b15a8063c87e27dbd68b7f048 Mon Sep 17 00:00:00 2001 From: Philip Welber Date: Wed, 20 Jun 2018 16:39:47 -0400 Subject: [PATCH] fix(Coinify): show general error if not email address in use --- .../src/data/modules/coinify/sagas.js | 2 +- .../Create/AcceptTerms/index.js | 4 +- .../Create/AcceptTerms/template.js | 45 +++++++++++++------ 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/packages/blockchain-wallet-v4-frontend/src/data/modules/coinify/sagas.js b/packages/blockchain-wallet-v4-frontend/src/data/modules/coinify/sagas.js index a9e44c6ee37..2503e7b6f94 100644 --- a/packages/blockchain-wallet-v4-frontend/src/data/modules/coinify/sagas.js +++ b/packages/blockchain-wallet-v4-frontend/src/data/modules/coinify/sagas.js @@ -23,7 +23,7 @@ export default ({ coreSagas }) => { yield call(coreSagas.data.coinify.triggerKYC) yield put(A.coinifyNextStep('isx')) } else { - yield put(A.coinifySignupFailure(profile.error)) + yield put(A.coinifySignupFailure(JSON.parse(profile.error))) } } catch (e) { yield put(actions.logs.logErrorMessage(logLocation, 'coinifySignup', e)) diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/index.js b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/index.js index 17965ad393e..c1c1ef626de 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/index.js @@ -31,7 +31,8 @@ class AcceptTermsContainer extends Component { render () { const { busy } = this.state - const { invalid, email, signupError, updateUI } = this.props + const { invalid, email, signupError, updateUI, coinifyFrontendActions } = this.props + const { coinifyClearSignupError } = coinifyFrontendActions return { this.props.updateUI({ create: 'change_email' }) }} + clearError={() => coinifyClearSignupError()} /> } } diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js index cf4fc25e0af..5212018cf47 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js +++ b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js @@ -9,6 +9,7 @@ import Terms from 'components/Terms' import { Button, HeartbeatLoader, Text, TextGroup, Link, Icon } from 'blockchain-info-components' import { Form, ColLeft, ColRight, InputWrapper, PartnerHeader, PartnerSubHeader, ButtonWrapper, ErrorWrapper, ColRightInner } from 'components/BuySell/Signup' import { spacing } from 'services/StyleService' +import { prop } from 'ramda' const AcceptTermsContainer = styled.div` display: flex; @@ -48,11 +49,10 @@ const IconContainer = styled.div` align-items: center; margin-left: 10px; ` +const checkboxShouldBeChecked = value => value ? undefined : 'You must agree to the terms and conditions' const AcceptTerms = (props) => { - const { busy, email, invalid, handleSubmit, signupError, updateUI, emailVerified, editEmail } = props - - const checkboxShouldBeChecked = value => value ? undefined : 'You must agree to the terms and conditions' + const { busy, email, invalid, handleSubmit, signupError, updateUI, emailVerified, editEmail, clearError } = props const helpers = [ { @@ -113,18 +113,35 @@ const AcceptTerms = (props) => { { - signupError && - - - - updateUI({ create: 'change_email' })}> - - - - + signupError && prop('error', signupError) === 'email_address_in_use' + ? + + + + updateUI({ create: 'change_email' })}> + + + + - - + + + : signupError + ? + + + + clearError()}> + + + + + + + + + + : null } {faqHelper()}