Merge pull request #21 from lbryio/email-verification
add doUserCheckEmailVerified instead of using doFetchUser
This commit is contained in:
commit
1627e26525
3 changed files with 57 additions and 36 deletions
36
dist/bundle.js
vendored
36
dist/bundle.js
vendored
|
@ -104,7 +104,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.selectUserInviteNewErrorMessage = exports.selectUserInviteNewIsPending = exports.selectUserInviteStatusFailed = exports.selectUserInvitees = exports.selectUserInvitesRemaining = exports.selectUserInviteStatusIsPending = exports.selectAccessToken = exports.selectUserIsVerificationCandidate = exports.selectIdentityVerifyErrorMessage = exports.selectIdentityVerifyIsPending = exports.selectPhoneVerifyIsPending = exports.selectPhoneVerifyErrorMessage = exports.selectEmailVerifyErrorMessage = exports.selectEmailVerifyIsPending = exports.selectPhoneNewIsPending = exports.selectPhoneNewErrorMessage = exports.selectEmailNewErrorMessage = exports.selectEmailNewIsPending = exports.selectUserIsRewardApproved = exports.selectPhoneToVerify = exports.selectEmailToVerify = exports.selectUserCountryCode = exports.selectUserPhone = exports.selectUserEmail = exports.selectUser = exports.selectUserIsPending = exports.selectAuthenticationIsPending = exports.selectRewardContentClaimIds = exports.selectRewardByType = exports.selectClaimRewardError = exports.selectClaimErrorsByType = exports.selectIsClaimRewardPending = exports.selectClaimsPendingByType = exports.selectUnclaimedRewardValue = exports.selectFetchingRewards = exports.selectUnclaimedRewards = exports.selectClaimedRewardsByTransactionId = exports.selectClaimedRewards = exports.selectClaimedRewardsById = exports.selectUnclaimedRewardsByType = exports.makeSelectRewardByType = exports.makeSelectRewardAmountByType = exports.makeSelectIsRewardClaimPending = exports.makeSelectClaimRewardError = exports.selectIsAuthenticating = exports.selectAuthToken = exports.userReducer = exports.rewardsReducer = exports.authReducer = exports.doUserInviteNew = exports.doUserIdentityVerify = exports.doUserResendVerificationEmail = exports.doFetchAccessToken = exports.doUserPhoneVerify = exports.doUserPhoneVerifyFailure = exports.doUserPhoneReset = exports.doUserPhoneNew = exports.doUserEmailVerify = exports.doUserEmailVerifyFailure = exports.doUserEmailToVerify = exports.doUserEmailNew = exports.doUserFetch = exports.doAuthenticate = exports.doInstallNew = exports.doFetchInviteStatus = exports.doFetchRewardedContent = exports.doClaimRewardClearError = exports.doClaimEligiblePurchaseRewards = exports.doClaimRewardType = exports.doRewardList = exports.doGenerateAuthToken = exports.rewards = exports.Lbryio = exports.LBRYINC_ACTIONS = undefined;
|
||||
exports.selectUserInviteNewErrorMessage = exports.selectUserInviteNewIsPending = exports.selectUserInviteStatusFailed = exports.selectUserInvitees = exports.selectUserInvitesRemaining = exports.selectUserInviteStatusIsPending = exports.selectAccessToken = exports.selectUserIsVerificationCandidate = exports.selectIdentityVerifyErrorMessage = exports.selectIdentityVerifyIsPending = exports.selectPhoneVerifyIsPending = exports.selectPhoneVerifyErrorMessage = exports.selectEmailVerifyErrorMessage = exports.selectEmailVerifyIsPending = exports.selectPhoneNewIsPending = exports.selectPhoneNewErrorMessage = exports.selectEmailNewErrorMessage = exports.selectEmailNewIsPending = exports.selectUserIsRewardApproved = exports.selectPhoneToVerify = exports.selectEmailToVerify = exports.selectUserCountryCode = exports.selectUserPhone = exports.selectUserEmail = exports.selectUser = exports.selectUserIsPending = exports.selectAuthenticationIsPending = exports.selectRewardContentClaimIds = exports.selectRewardByType = exports.selectClaimRewardError = exports.selectClaimErrorsByType = exports.selectIsClaimRewardPending = exports.selectClaimsPendingByType = exports.selectUnclaimedRewardValue = exports.selectFetchingRewards = exports.selectUnclaimedRewards = exports.selectClaimedRewardsByTransactionId = exports.selectClaimedRewards = exports.selectClaimedRewardsById = exports.selectUnclaimedRewardsByType = exports.makeSelectRewardByType = exports.makeSelectRewardAmountByType = exports.makeSelectIsRewardClaimPending = exports.makeSelectClaimRewardError = exports.selectIsAuthenticating = exports.selectAuthToken = exports.userReducer = exports.rewardsReducer = exports.authReducer = exports.doUserInviteNew = exports.doUserIdentityVerify = exports.doUserResendVerificationEmail = exports.doFetchAccessToken = exports.doUserPhoneVerify = exports.doUserPhoneVerifyFailure = exports.doUserPhoneReset = exports.doUserPhoneNew = exports.doUserEmailVerify = exports.doUserEmailVerifyFailure = exports.doUserEmailToVerify = exports.doUserCheckEmailVerified = exports.doUserEmailNew = exports.doUserFetch = exports.doAuthenticate = exports.doInstallNew = exports.doFetchInviteStatus = exports.doFetchRewardedContent = exports.doClaimRewardClearError = exports.doClaimEligiblePurchaseRewards = exports.doClaimRewardType = exports.doRewardList = exports.doGenerateAuthToken = exports.rewards = exports.Lbryio = exports.LBRYINC_ACTIONS = undefined;
|
||||
|
||||
var _auth = __webpack_require__(1);
|
||||
|
||||
|
@ -180,6 +180,12 @@ Object.defineProperty(exports, 'doUserEmailNew', {
|
|||
return _user.doUserEmailNew;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doUserCheckEmailVerified', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _user.doUserCheckEmailVerified;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doUserEmailToVerify', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
|
@ -8585,6 +8591,7 @@ exports.doFetchInviteStatus = doFetchInviteStatus;
|
|||
exports.doInstallNew = doInstallNew;
|
||||
exports.doAuthenticate = doAuthenticate;
|
||||
exports.doUserFetch = doUserFetch;
|
||||
exports.doUserCheckEmailVerified = doUserCheckEmailVerified;
|
||||
exports.doUserPhoneReset = doUserPhoneReset;
|
||||
exports.doUserPhoneNew = doUserPhoneNew;
|
||||
exports.doUserPhoneVerifyFailure = doUserPhoneVerifyFailure;
|
||||
|
@ -8680,17 +8687,8 @@ function doAuthenticate(appVersion) {
|
|||
};
|
||||
}
|
||||
|
||||
function doUserFetch(fetchSilently) {
|
||||
function doUserFetch() {
|
||||
return function (dispatch) {
|
||||
// If we are doing this in the background, do not set loading = true
|
||||
if (fetchSilently) {
|
||||
return _lbryio2.default.getCurrentUser().then(function (user) {
|
||||
dispatch({
|
||||
type: _lbryRedux.ACTIONS.USER_FETCH_SUCCESS,
|
||||
data: { user: user }
|
||||
});
|
||||
});
|
||||
}
|
||||
dispatch({
|
||||
type: _lbryRedux.ACTIONS.USER_FETCH_STARTED
|
||||
});
|
||||
|
@ -8711,6 +8709,22 @@ function doUserFetch(fetchSilently) {
|
|||
};
|
||||
}
|
||||
|
||||
function doUserCheckEmailVerified() {
|
||||
// This will happen in the background so we don't need loading booleans
|
||||
return function (dispatch) {
|
||||
_lbryio2.default.getCurrentUser().then(function (user) {
|
||||
if (user.has_verified_email) {
|
||||
dispatch((0, _rewards.doRewardList)());
|
||||
|
||||
dispatch({
|
||||
type: _lbryRedux.ACTIONS.USER_FETCH_SUCCESS,
|
||||
data: { user: user }
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function doUserPhoneReset() {
|
||||
return {
|
||||
type: _lbryRedux.ACTIONS.USER_PHONE_RESET
|
||||
|
|
|
@ -23,6 +23,7 @@ export {
|
|||
doAuthenticate,
|
||||
doUserFetch,
|
||||
doUserEmailNew,
|
||||
doUserCheckEmailVerified,
|
||||
doUserEmailToVerify,
|
||||
doUserEmailVerifyFailure,
|
||||
doUserEmailVerify,
|
||||
|
|
|
@ -74,37 +74,43 @@ export function doAuthenticate(appVersion, os = null) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doUserFetch(fetchSilently) {
|
||||
export function doUserFetch() {
|
||||
return dispatch => {
|
||||
// If we are doing this in the background, do not set loading = true
|
||||
if (fetchSilently) {
|
||||
Lbryio.getCurrentUser().then(user => {
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_STARTED,
|
||||
});
|
||||
Lbryio.getCurrentUser()
|
||||
.then(user => {
|
||||
// analytics.setUser(user);
|
||||
dispatch(doRewardList());
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_SUCCESS,
|
||||
data: { user },
|
||||
});
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_STARTED,
|
||||
});
|
||||
Lbryio.getCurrentUser()
|
||||
.then(user => {
|
||||
// analytics.setUser(user);
|
||||
dispatch(doRewardList());
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_SUCCESS,
|
||||
data: { user },
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_FAILURE,
|
||||
data: { error },
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_FAILURE,
|
||||
data: { error },
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doUserCheckEmailVerified() {
|
||||
// This will happen in the background so we don't need loading booleans
|
||||
return dispatch => {
|
||||
Lbryio.getCurrentUser().then(user => {
|
||||
if (user.has_verified_email) {
|
||||
dispatch(doRewardList());
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_SUCCESS,
|
||||
data: { user },
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue