Skip to content

Commit

Permalink
fix(Alert): setup alert for resend mobile code
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed Aug 8, 2018
1 parent 694cb63 commit b342a69
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const VERIFY_EMAIL_CODE_FAILURE = '@COMPONENT.VERIFY_EMAIL_CODE_FAILURE'
export const CLEAR_EMAIL_CODE_FAILURE = '@COMPONENT.CLEAR_EMAIL_CODE_FAILURE'

export const UPDATE_MOBILE = '@COMPONENT.UPDATE_MOBILE'
export const RESEND_MOBILE = '@COMPONENT.RESEND_MOBILE'

export const VERIFY_MOBILE = '@COMPONENT.VERIFY_MOBILE'
export const VERIFY_MOBILE_FAILURE = '@COMPONENT.VERIFY_MOBILE_FAILURE'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const updateMobile = mobile => ({
type: AT.UPDATE_MOBILE,
payload: { mobile }
})
export const resendMobile = mobile => ({
type: AT.RESEND_MOBILE,
payload: { mobile }
})
export const verifyMobileFailure = () => ({ type: AT.VERIFY_MOBILE_FAILURE })
export const clearMobileFailure = () => ({ type: AT.CLEAR_MOBILE_FAILURE })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default ({ coreSagas }) => {
settingsSagas.showGoogleAuthenticatorSecretUrl
)
yield takeLatest(AT.UPDATE_MOBILE, settingsSagas.updateMobile)
yield takeLatest(AT.RESEND_MOBILE, settingsSagas.resendMobile)
yield takeLatest(AT.VERIFY_MOBILE, settingsSagas.verifyMobile)
yield takeLatest(AT.UPDATE_LANGUAGE, settingsSagas.updateLanguage)
yield takeLatest(AT.UPDATE_CURRENCY, settingsSagas.updateCurrency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,23 @@ export default ({ coreSagas }) => {
const updateMobile = function*(action) {
try {
yield call(coreSagas.settings.setMobile, action.payload)

yield put(actions.alerts.displaySuccess(C.MOBILE_UPDATE_SUCCESS))
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'updateMobile', e))
yield put(actions.alerts.displayError(C.MOBILE_UPDATE_ERROR))
}
}

const resendMobile = function*(action) {
try {
yield call(coreSagas.settings.setMobile, action.payload)
yield put(actions.alerts.displaySuccess(C.MOBILE_RESEND_SUCCESS))
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'resendMobile', e))
yield put(actions.alerts.displayError(C.MOBILE_UPDATE_ERROR))
}
}

const verifyMobile = function*(action) {
try {
yield call(coreSagas.settings.setMobileVerified, action.payload)
Expand Down Expand Up @@ -319,6 +328,7 @@ export default ({ coreSagas }) => {
showBackupRecovery,
showGoogleAuthenticatorSecretUrl,
updateMobile,
resendMobile,
verifyMobile,
updateLanguage,
updateCurrency,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class MobileNumberVerifyContainer extends React.PureComponent {
}

handleResend () {
this.props.settingsActions.updateMobile(this.props.mobileNumber)

this.props.settingsActions.resendMobile(this.props.mobileNumber)
}

handleChange () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class VerifyMobile extends Component {

resendCode () {
this.props.updateUI({ smsCodeResent: true })
this.props.settingsActions.updateMobile(this.props.mobileNumber)
this.props.settingsActions.resendMobile(this.props.mobileNumber)
}

onSubmit (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const MOBILE_LOGIN_ERROR_QRCODE_EXPIRED =
export const MOBILE_LOGIN_SCAN_ERROR = 'mobile_login_scan_error'
export const MOBILE_UPDATE_ERROR = 'mobile_update_error'
export const MOBILE_UPDATE_SUCCESS = 'mobile_update_success'
export const MOBILE_RESEND_SUCCESS = 'mobile_resend_success'
export const MOBILE_VERIFY_ERROR = 'mobile_verify_error'
export const MOBILE_VERIFY_SUCCESS = 'mobile_verify_success'
export const NEW_ADDRESS_GENERATE_ERROR = 'new_address_generate_error'
Expand Down

0 comments on commit b342a69

Please sign in to comment.