Merge pull request #1637 from lbryio/phone-verify-reward

Fix phone verification + claim first reward
This commit is contained in:
Sean Yesmunt 2018-06-18 18:56:23 -04:00 committed by GitHub
commit 171ea2b97b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View file

@ -1,6 +1,6 @@
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import Lbryio from 'lbryio'; import Lbryio from 'lbryio';
import { Lbry, doNotify, MODALS } from 'lbry-redux'; import { Lbry, doNotify, MODALS, doHideNotification } from 'lbry-redux';
import { doClaimRewardType, doRewardList } from 'redux/actions/rewards'; import { doClaimRewardType, doRewardList } from 'redux/actions/rewards';
import { import {
selectEmailToVerify, selectEmailToVerify,
@ -163,13 +163,15 @@ export function doUserPhoneVerify(verificationCode) {
}, },
'post' 'post'
) )
.then(() => { .then(user => {
if (user.is_identity_verified) {
dispatch({ dispatch({
type: ACTIONS.USER_PHONE_VERIFY_SUCCESS, type: ACTIONS.USER_PHONE_VERIFY_SUCCESS,
data: { phone_number: phoneNumber }, data: { user },
}); });
dispatch(doUserFetch()); dispatch(doHideNotification());
dispatch(doClaimRewardType(rewards.TYPE_NEW_USER)); dispatch(doClaimRewardType(rewards.TYPE_NEW_USER));
}
}) })
.catch(error => dispatch(doUserPhoneVerifyFailure(error))); .catch(error => dispatch(doUserPhoneVerifyFailure(error)));
}; };

View file

@ -88,13 +88,12 @@ reducers[ACTIONS.USER_PHONE_VERIFY_STARTED] = state =>
phoneVerifyErrorMessage: '', phoneVerifyErrorMessage: '',
}); });
reducers[ACTIONS.USER_PHONE_VERIFY_SUCCESS] = (state, action) => { reducers[ACTIONS.USER_PHONE_VERIFY_SUCCESS] = (state, action) =>
Object.assign({}, state, { Object.assign({}, state, {
phoneToVerify: '', phoneToVerify: '',
phoneVerifyIsPending: false, phoneVerifyIsPending: false,
user: action.data.user, user: action.data.user,
}); });
};
reducers[ACTIONS.USER_PHONE_VERIFY_FAILURE] = (state, action) => reducers[ACTIONS.USER_PHONE_VERIFY_FAILURE] = (state, action) =>
Object.assign({}, state, { Object.assign({}, state, {