add doUserCheckEmailVerified instead of using doFetchUser #21

Merged
neb-b merged 1 commit from email-verification into master 2019-01-09 23:04:56 +01:00
3 changed files with 57 additions and 36 deletions
Showing only changes of commit b3bb8c6774 - Show all commits

36
dist/bundle.js vendored
View file

@ -104,7 +104,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true 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); var _auth = __webpack_require__(1);
@ -180,6 +180,12 @@ Object.defineProperty(exports, 'doUserEmailNew', {
return _user.doUserEmailNew; return _user.doUserEmailNew;
} }
}); });
Object.defineProperty(exports, 'doUserCheckEmailVerified', {
enumerable: true,
get: function get() {
return _user.doUserCheckEmailVerified;
}
});
Object.defineProperty(exports, 'doUserEmailToVerify', { Object.defineProperty(exports, 'doUserEmailToVerify', {
enumerable: true, enumerable: true,
get: function get() { get: function get() {
@ -8585,6 +8591,7 @@ exports.doFetchInviteStatus = doFetchInviteStatus;
exports.doInstallNew = doInstallNew; exports.doInstallNew = doInstallNew;
exports.doAuthenticate = doAuthenticate; exports.doAuthenticate = doAuthenticate;
exports.doUserFetch = doUserFetch; exports.doUserFetch = doUserFetch;
exports.doUserCheckEmailVerified = doUserCheckEmailVerified;
exports.doUserPhoneReset = doUserPhoneReset; exports.doUserPhoneReset = doUserPhoneReset;
exports.doUserPhoneNew = doUserPhoneNew; exports.doUserPhoneNew = doUserPhoneNew;
exports.doUserPhoneVerifyFailure = doUserPhoneVerifyFailure; exports.doUserPhoneVerifyFailure = doUserPhoneVerifyFailure;
@ -8680,17 +8687,8 @@ function doAuthenticate(appVersion) {
}; };
} }
function doUserFetch(fetchSilently) { function doUserFetch() {
return function (dispatch) { 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({ dispatch({
type: _lbryRedux.ACTIONS.USER_FETCH_STARTED 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() { function doUserPhoneReset() {
return { return {
type: _lbryRedux.ACTIONS.USER_PHONE_RESET type: _lbryRedux.ACTIONS.USER_PHONE_RESET

View file

@ -23,6 +23,7 @@ export {
doAuthenticate, doAuthenticate,
doUserFetch, doUserFetch,
doUserEmailNew, doUserEmailNew,
doUserCheckEmailVerified,
doUserEmailToVerify, doUserEmailToVerify,
doUserEmailVerifyFailure, doUserEmailVerifyFailure,
doUserEmailVerify, doUserEmailVerify,

View file

@ -74,17 +74,8 @@ export function doAuthenticate(appVersion, os = null) {
}; };
} }
export function doUserFetch(fetchSilently) { export function doUserFetch() {
return dispatch => { 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_SUCCESS,
data: { user },
});
});
} else {
dispatch({ dispatch({
type: ACTIONS.USER_FETCH_STARTED, type: ACTIONS.USER_FETCH_STARTED,
}); });
@ -104,7 +95,22 @@ export function doUserFetch(fetchSilently) {
data: { error }, 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 },
});
} }
});
}; };
} }