add values for existingUser/resendingVerificationEmail
This commit is contained in:
parent
fcf02a2bfa
commit
5e0bb245ed
7 changed files with 124 additions and 38 deletions
48
dist/bundle.es.js
vendored
48
dist/bundle.es.js
vendored
|
@ -24,7 +24,9 @@ const USER_EMAIL_VERIFY_SET = 'USER_EMAIL_VERIFY_SET';
|
||||||
const USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
|
const USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
|
||||||
const USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
|
const USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
|
||||||
const USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
|
const USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
|
||||||
const USER_EMAIL_VERIFY_RETRY = 'USER_EMAIL_VERIFY_RETRY';
|
const USER_EMAIL_VERIFY_RETRY_STARTED = 'USER_EMAIL_VERIFY_RETRY_STARTED';
|
||||||
|
const USER_EMAIL_VERIFY_RETRY_FAILURE = 'USER_EMAIL_VERIFY_RETRY_FAILURE';
|
||||||
|
const USER_EMAIL_VERIFY_RETRY_SUCCESS = 'USER_EMAIL_VERIFY_RETRY_SUCCESS';
|
||||||
const USER_PHONE_RESET = 'USER_PHONE_RESET';
|
const USER_PHONE_RESET = 'USER_PHONE_RESET';
|
||||||
const USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
|
const USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
|
||||||
const USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
|
const USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
|
||||||
|
@ -147,7 +149,9 @@ var action_types = /*#__PURE__*/Object.freeze({
|
||||||
USER_EMAIL_VERIFY_STARTED: USER_EMAIL_VERIFY_STARTED,
|
USER_EMAIL_VERIFY_STARTED: USER_EMAIL_VERIFY_STARTED,
|
||||||
USER_EMAIL_VERIFY_SUCCESS: USER_EMAIL_VERIFY_SUCCESS,
|
USER_EMAIL_VERIFY_SUCCESS: USER_EMAIL_VERIFY_SUCCESS,
|
||||||
USER_EMAIL_VERIFY_FAILURE: USER_EMAIL_VERIFY_FAILURE,
|
USER_EMAIL_VERIFY_FAILURE: USER_EMAIL_VERIFY_FAILURE,
|
||||||
USER_EMAIL_VERIFY_RETRY: USER_EMAIL_VERIFY_RETRY,
|
USER_EMAIL_VERIFY_RETRY_STARTED: USER_EMAIL_VERIFY_RETRY_STARTED,
|
||||||
|
USER_EMAIL_VERIFY_RETRY_FAILURE: USER_EMAIL_VERIFY_RETRY_FAILURE,
|
||||||
|
USER_EMAIL_VERIFY_RETRY_SUCCESS: USER_EMAIL_VERIFY_RETRY_SUCCESS,
|
||||||
USER_PHONE_RESET: USER_PHONE_RESET,
|
USER_PHONE_RESET: USER_PHONE_RESET,
|
||||||
USER_PHONE_NEW_STARTED: USER_PHONE_NEW_STARTED,
|
USER_PHONE_NEW_STARTED: USER_PHONE_NEW_STARTED,
|
||||||
USER_PHONE_NEW_SUCCESS: USER_PHONE_NEW_SUCCESS,
|
USER_PHONE_NEW_SUCCESS: USER_PHONE_NEW_SUCCESS,
|
||||||
|
@ -1101,6 +1105,8 @@ const selectState$2 = state => state.user || {};
|
||||||
const selectAuthenticationIsPending = reselect.createSelector(selectState$2, state => state.authenticationIsPending);
|
const selectAuthenticationIsPending = reselect.createSelector(selectState$2, state => state.authenticationIsPending);
|
||||||
const selectUserIsPending = reselect.createSelector(selectState$2, state => state.userIsPending);
|
const selectUserIsPending = reselect.createSelector(selectState$2, state => state.userIsPending);
|
||||||
const selectUser = reselect.createSelector(selectState$2, state => state.user);
|
const selectUser = reselect.createSelector(selectState$2, state => state.user);
|
||||||
|
const selectEmailAlreadyExists = reselect.createSelector(selectState$2, state => state.emailAlreadyExists);
|
||||||
|
const selectResendingVerificationEmail = reselect.createSelector(selectState$2, state => state.resendingVerificationEmail);
|
||||||
const selectUserEmail = reselect.createSelector(selectUser, user => user ? user.primary_email : null);
|
const selectUserEmail = reselect.createSelector(selectUser, user => user ? user.primary_email : null);
|
||||||
const selectUserPhone = reselect.createSelector(selectUser, user => user ? user.phone_number : null);
|
const selectUserPhone = reselect.createSelector(selectUser, user => user ? user.phone_number : null);
|
||||||
const selectUserCountryCode = reselect.createSelector(selectUser, user => user ? user.country_code : null);
|
const selectUserCountryCode = reselect.createSelector(selectUser, user => user ? user.country_code : null);
|
||||||
|
@ -1363,6 +1369,9 @@ function doUserEmailNew(email) {
|
||||||
send_verification_email: true
|
send_verification_email: true
|
||||||
}, 'post').catch(error => {
|
}, 'post').catch(error => {
|
||||||
if (error.response && error.response.status === 409) {
|
if (error.response && error.response.status === 409) {
|
||||||
|
dispatch({
|
||||||
|
type: USER_EMAIL_NEW_EXISTS
|
||||||
|
});
|
||||||
return Lbryio.call('user_email', 'resend_token', {
|
return Lbryio.call('user_email', 'resend_token', {
|
||||||
email,
|
email,
|
||||||
only_if_expired: true
|
only_if_expired: true
|
||||||
|
@ -1376,23 +1385,18 @@ function doUserEmailNew(email) {
|
||||||
function doUserResendVerificationEmail(email) {
|
function doUserResendVerificationEmail(email) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_EMAIL_VERIFY_RETRY,
|
type: USER_EMAIL_VERIFY_RETRY_STARTED
|
||||||
email
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = () => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_EMAIL_NEW_SUCCESS,
|
type: USER_EMAIL_VERIFY_RETRY_SUCCESS
|
||||||
data: {
|
|
||||||
email
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
dispatch(doUserFetch());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const failure = error => {
|
const failure = error => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_EMAIL_NEW_FAILURE,
|
type: USER_EMAIL_VERIFY_RETRY_FAILURE,
|
||||||
data: {
|
data: {
|
||||||
error
|
error
|
||||||
}
|
}
|
||||||
|
@ -2769,6 +2773,8 @@ const defaultState$3 = {
|
||||||
emailNewIsPending: false,
|
emailNewIsPending: false,
|
||||||
emailNewErrorMessage: '',
|
emailNewErrorMessage: '',
|
||||||
emailToVerify: '',
|
emailToVerify: '',
|
||||||
|
emailAlreadyExists: false,
|
||||||
|
resendingVerificationEmail: false,
|
||||||
inviteNewErrorMessage: '',
|
inviteNewErrorMessage: '',
|
||||||
inviteNewIsPending: false,
|
inviteNewIsPending: false,
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
|
@ -2854,7 +2860,8 @@ reducers$2[USER_PHONE_VERIFY_FAILURE] = (state, action) => Object.assign({}, sta
|
||||||
|
|
||||||
reducers$2[USER_EMAIL_NEW_STARTED] = state => Object.assign({}, state, {
|
reducers$2[USER_EMAIL_NEW_STARTED] = state => Object.assign({}, state, {
|
||||||
emailNewIsPending: true,
|
emailNewIsPending: true,
|
||||||
emailNewErrorMessage: ''
|
emailNewErrorMessage: '',
|
||||||
|
emailAlreadyExists: false
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[USER_EMAIL_NEW_SUCCESS] = (state, action) => {
|
reducers$2[USER_EMAIL_NEW_SUCCESS] = (state, action) => {
|
||||||
|
@ -2867,9 +2874,8 @@ reducers$2[USER_EMAIL_NEW_SUCCESS] = (state, action) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers$2[USER_EMAIL_NEW_EXISTS] = (state, action) => Object.assign({}, state, {
|
reducers$2[USER_EMAIL_NEW_EXISTS] = state => Object.assign({}, state, {
|
||||||
emailToVerify: action.data.email,
|
emailAlreadyExists: true
|
||||||
emailNewIsPending: false
|
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[USER_EMAIL_NEW_FAILURE] = (state, action) => Object.assign({}, state, {
|
reducers$2[USER_EMAIL_NEW_FAILURE] = (state, action) => Object.assign({}, state, {
|
||||||
|
@ -2979,6 +2985,18 @@ reducers$2[USER_YOUTUBE_IMPORT_FAILURE] = (state, action) => Object.assign({}, s
|
||||||
youtubeChannelImportErrorMessage: action.data
|
youtubeChannelImportErrorMessage: action.data
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers$2[USER_EMAIL_VERIFY_RETRY_STARTED] = state => Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: true
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers$2[USER_EMAIL_VERIFY_RETRY_SUCCESS] = state => Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: false
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers$2[USER_EMAIL_VERIFY_RETRY_FAILURE] = state => Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: false
|
||||||
|
});
|
||||||
|
|
||||||
function userReducer(state = defaultState$3, action) {
|
function userReducer(state = defaultState$3, action) {
|
||||||
const handler = reducers$2[action.type];
|
const handler = reducers$2[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
|
@ -3430,6 +3448,7 @@ exports.selectClaimedRewardsById = selectClaimedRewardsById;
|
||||||
exports.selectClaimedRewardsByTransactionId = selectClaimedRewardsByTransactionId;
|
exports.selectClaimedRewardsByTransactionId = selectClaimedRewardsByTransactionId;
|
||||||
exports.selectClaimsPendingByType = selectClaimsPendingByType;
|
exports.selectClaimsPendingByType = selectClaimsPendingByType;
|
||||||
exports.selectCurrentUploads = selectCurrentUploads;
|
exports.selectCurrentUploads = selectCurrentUploads;
|
||||||
|
exports.selectEmailAlreadyExists = selectEmailAlreadyExists;
|
||||||
exports.selectEmailNewErrorMessage = selectEmailNewErrorMessage;
|
exports.selectEmailNewErrorMessage = selectEmailNewErrorMessage;
|
||||||
exports.selectEmailNewIsPending = selectEmailNewIsPending;
|
exports.selectEmailNewIsPending = selectEmailNewIsPending;
|
||||||
exports.selectEmailToVerify = selectEmailToVerify;
|
exports.selectEmailToVerify = selectEmailToVerify;
|
||||||
|
@ -3458,6 +3477,7 @@ exports.selectPhoneToVerify = selectPhoneToVerify;
|
||||||
exports.selectPhoneVerifyErrorMessage = selectPhoneVerifyErrorMessage;
|
exports.selectPhoneVerifyErrorMessage = selectPhoneVerifyErrorMessage;
|
||||||
exports.selectPhoneVerifyIsPending = selectPhoneVerifyIsPending;
|
exports.selectPhoneVerifyIsPending = selectPhoneVerifyIsPending;
|
||||||
exports.selectReferralReward = selectReferralReward;
|
exports.selectReferralReward = selectReferralReward;
|
||||||
|
exports.selectResendingVerificationEmail = selectResendingVerificationEmail;
|
||||||
exports.selectRewardContentClaimIds = selectRewardContentClaimIds;
|
exports.selectRewardContentClaimIds = selectRewardContentClaimIds;
|
||||||
exports.selectSetSyncErrorMessage = selectSetSyncErrorMessage;
|
exports.selectSetSyncErrorMessage = selectSetSyncErrorMessage;
|
||||||
exports.selectSetSyncIsPending = selectSetSyncIsPending;
|
exports.selectSetSyncIsPending = selectSetSyncIsPending;
|
||||||
|
|
62
dist/bundle.js
vendored
62
dist/bundle.js
vendored
|
@ -371,6 +371,10 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectEmailVerifyErrorMessage", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectEmailVerifyErrorMessage"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectEmailVerifyErrorMessage", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectEmailVerifyErrorMessage"]; });
|
||||||
|
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectEmailAlreadyExists", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectEmailAlreadyExists"]; });
|
||||||
|
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectResendingVerificationEmail", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectResendingVerificationEmail"]; });
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectPhoneVerifyErrorMessage", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectPhoneVerifyErrorMessage"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectPhoneVerifyErrorMessage", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectPhoneVerifyErrorMessage"]; });
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectPhoneVerifyIsPending", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectPhoneVerifyIsPending"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectPhoneVerifyIsPending", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectPhoneVerifyIsPending"]; });
|
||||||
|
@ -531,7 +535,9 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_STARTED", function() { return USER_EMAIL_VERIFY_STARTED; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_STARTED", function() { return USER_EMAIL_VERIFY_STARTED; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_SUCCESS", function() { return USER_EMAIL_VERIFY_SUCCESS; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_SUCCESS", function() { return USER_EMAIL_VERIFY_SUCCESS; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_FAILURE", function() { return USER_EMAIL_VERIFY_FAILURE; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_FAILURE", function() { return USER_EMAIL_VERIFY_FAILURE; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY", function() { return USER_EMAIL_VERIFY_RETRY; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY_STARTED", function() { return USER_EMAIL_VERIFY_RETRY_STARTED; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY_FAILURE", function() { return USER_EMAIL_VERIFY_RETRY_FAILURE; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY_SUCCESS", function() { return USER_EMAIL_VERIFY_RETRY_SUCCESS; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_RESET", function() { return USER_PHONE_RESET; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_RESET", function() { return USER_PHONE_RESET; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_NEW_STARTED", function() { return USER_PHONE_NEW_STARTED; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_NEW_STARTED", function() { return USER_PHONE_NEW_STARTED; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_NEW_SUCCESS", function() { return USER_PHONE_NEW_SUCCESS; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_NEW_SUCCESS", function() { return USER_PHONE_NEW_SUCCESS; });
|
||||||
|
@ -645,7 +651,9 @@ var USER_EMAIL_VERIFY_SET = 'USER_EMAIL_VERIFY_SET';
|
||||||
var USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
|
var USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
|
||||||
var USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
|
var USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
|
||||||
var USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
|
var USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
|
||||||
var USER_EMAIL_VERIFY_RETRY = 'USER_EMAIL_VERIFY_RETRY';
|
var USER_EMAIL_VERIFY_RETRY_STARTED = 'USER_EMAIL_VERIFY_RETRY_STARTED';
|
||||||
|
var USER_EMAIL_VERIFY_RETRY_FAILURE = 'USER_EMAIL_VERIFY_RETRY_FAILURE';
|
||||||
|
var USER_EMAIL_VERIFY_RETRY_SUCCESS = 'USER_EMAIL_VERIFY_RETRY_SUCCESS';
|
||||||
var USER_PHONE_RESET = 'USER_PHONE_RESET';
|
var USER_PHONE_RESET = 'USER_PHONE_RESET';
|
||||||
var USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
|
var USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
|
||||||
var USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
|
var USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
|
||||||
|
@ -2432,6 +2440,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectAuthenticationIsPending", function() { return selectAuthenticationIsPending; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectAuthenticationIsPending", function() { return selectAuthenticationIsPending; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserIsPending", function() { return selectUserIsPending; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserIsPending", function() { return selectUserIsPending; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUser", function() { return selectUser; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUser", function() { return selectUser; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectEmailAlreadyExists", function() { return selectEmailAlreadyExists; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectResendingVerificationEmail", function() { return selectResendingVerificationEmail; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserEmail", function() { return selectUserEmail; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserEmail", function() { return selectUserEmail; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserPhone", function() { return selectUserPhone; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserPhone", function() { return selectUserPhone; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserCountryCode", function() { return selectUserCountryCode; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserCountryCode", function() { return selectUserCountryCode; });
|
||||||
|
@ -2477,6 +2487,12 @@ var selectUserIsPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSe
|
||||||
var selectUser = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
var selectUser = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
return state.user;
|
return state.user;
|
||||||
});
|
});
|
||||||
|
var selectEmailAlreadyExists = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
|
return state.emailAlreadyExists;
|
||||||
|
});
|
||||||
|
var selectResendingVerificationEmail = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
|
return state.resendingVerificationEmail;
|
||||||
|
});
|
||||||
var selectUserEmail = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectUser, function (user) {
|
var selectUserEmail = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectUser, function (user) {
|
||||||
return user ? user.primary_email : null;
|
return user ? user.primary_email : null;
|
||||||
});
|
});
|
||||||
|
@ -2853,6 +2869,9 @@ function doUserEmailNew(email) {
|
||||||
send_verification_email: true
|
send_verification_email: true
|
||||||
}, 'post')["catch"](function (error) {
|
}, 'post')["catch"](function (error) {
|
||||||
if (error.response && error.response.status === 409) {
|
if (error.response && error.response.status === 409) {
|
||||||
|
dispatch({
|
||||||
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_EXISTS"]
|
||||||
|
});
|
||||||
return lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('user_email', 'resend_token', {
|
return lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('user_email', 'resend_token', {
|
||||||
email: email,
|
email: email,
|
||||||
only_if_expired: true
|
only_if_expired: true
|
||||||
|
@ -2866,23 +2885,18 @@ function doUserEmailNew(email) {
|
||||||
function doUserResendVerificationEmail(email) {
|
function doUserResendVerificationEmail(email) {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY_STARTED"]
|
||||||
email: email
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var success = function success() {
|
var success = function success() {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_SUCCESS"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY_SUCCESS"]
|
||||||
data: {
|
|
||||||
email: email
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
dispatch(doUserFetch());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var failure = function failure(error) {
|
var failure = function failure(error) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_FAILURE"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY_FAILURE"],
|
||||||
data: {
|
data: {
|
||||||
error: error
|
error: error
|
||||||
}
|
}
|
||||||
|
@ -4410,6 +4424,8 @@ var defaultState = {
|
||||||
emailNewIsPending: false,
|
emailNewIsPending: false,
|
||||||
emailNewErrorMessage: '',
|
emailNewErrorMessage: '',
|
||||||
emailToVerify: '',
|
emailToVerify: '',
|
||||||
|
emailAlreadyExists: false,
|
||||||
|
resendingVerificationEmail: false,
|
||||||
inviteNewErrorMessage: '',
|
inviteNewErrorMessage: '',
|
||||||
inviteNewIsPending: false,
|
inviteNewIsPending: false,
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
|
@ -4520,7 +4536,8 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_PHONE_VERIFY_
|
||||||
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_STARTED"]] = function (state) {
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_STARTED"]] = function (state) {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
emailNewIsPending: true,
|
emailNewIsPending: true,
|
||||||
emailNewErrorMessage: ''
|
emailNewErrorMessage: '',
|
||||||
|
emailAlreadyExists: false
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4534,10 +4551,9 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_SUC
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_EXISTS"]] = function (state, action) {
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_EXISTS"]] = function (state) {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
emailToVerify: action.data.email,
|
emailAlreadyExists: true
|
||||||
emailNewIsPending: false
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4680,6 +4696,24 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_YOUTUBE_IMPOR
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_VERIFY_RETRY_STARTED"]] = function (state) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_VERIFY_RETRY_SUCCESS"]] = function (state) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_VERIFY_RETRY_FAILURE"]] = function (state) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function userReducer() {
|
function userReducer() {
|
||||||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
|
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
|
||||||
var action = arguments.length > 1 ? arguments[1] : undefined;
|
var action = arguments.length > 1 ? arguments[1] : undefined;
|
||||||
|
|
|
@ -14,7 +14,9 @@ export const USER_EMAIL_VERIFY_SET = 'USER_EMAIL_VERIFY_SET';
|
||||||
export const USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
|
export const USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
|
||||||
export const USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
|
export const USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
|
||||||
export const USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
|
export const USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
|
||||||
export const USER_EMAIL_VERIFY_RETRY = 'USER_EMAIL_VERIFY_RETRY';
|
export const USER_EMAIL_VERIFY_RETRY_STARTED = 'USER_EMAIL_VERIFY_RETRY_STARTED';
|
||||||
|
export const USER_EMAIL_VERIFY_RETRY_FAILURE = 'USER_EMAIL_VERIFY_RETRY_FAILURE';
|
||||||
|
export const USER_EMAIL_VERIFY_RETRY_SUCCESS = 'USER_EMAIL_VERIFY_RETRY_SUCCESS';
|
||||||
export const USER_PHONE_RESET = 'USER_PHONE_RESET';
|
export const USER_PHONE_RESET = 'USER_PHONE_RESET';
|
||||||
export const USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
|
export const USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
|
||||||
export const USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
|
export const USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
|
||||||
|
|
|
@ -144,6 +144,8 @@ export {
|
||||||
selectPhoneNewIsPending,
|
selectPhoneNewIsPending,
|
||||||
selectEmailVerifyIsPending,
|
selectEmailVerifyIsPending,
|
||||||
selectEmailVerifyErrorMessage,
|
selectEmailVerifyErrorMessage,
|
||||||
|
selectEmailAlreadyExists,
|
||||||
|
selectResendingVerificationEmail,
|
||||||
selectPhoneVerifyErrorMessage,
|
selectPhoneVerifyErrorMessage,
|
||||||
selectPhoneVerifyIsPending,
|
selectPhoneVerifyIsPending,
|
||||||
selectIdentityVerifyIsPending,
|
selectIdentityVerifyIsPending,
|
||||||
|
|
|
@ -230,6 +230,10 @@ export function doUserEmailNew(email) {
|
||||||
Lbryio.call('user_email', 'new', { email, send_verification_email: true }, 'post')
|
Lbryio.call('user_email', 'new', { email, send_verification_email: true }, 'post')
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.response && error.response.status === 409) {
|
if (error.response && error.response.status === 409) {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.USER_EMAIL_NEW_EXISTS,
|
||||||
|
});
|
||||||
|
|
||||||
return Lbryio.call(
|
return Lbryio.call(
|
||||||
'user_email',
|
'user_email',
|
||||||
'resend_token',
|
'resend_token',
|
||||||
|
@ -246,21 +250,18 @@ export function doUserEmailNew(email) {
|
||||||
export function doUserResendVerificationEmail(email) {
|
export function doUserResendVerificationEmail(email) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.USER_EMAIL_VERIFY_RETRY,
|
type: ACTIONS.USER_EMAIL_VERIFY_RETRY_STARTED,
|
||||||
email,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = () => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.USER_EMAIL_NEW_SUCCESS,
|
type: ACTIONS.USER_EMAIL_VERIFY_RETRY_SUCCESS,
|
||||||
data: { email },
|
|
||||||
});
|
});
|
||||||
dispatch(doUserFetch());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const failure = error => {
|
const failure = error => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.USER_EMAIL_NEW_FAILURE,
|
type: ACTIONS.USER_EMAIL_VERIFY_RETRY_FAILURE,
|
||||||
data: { error },
|
data: { error },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,8 @@ const defaultState = {
|
||||||
emailNewIsPending: false,
|
emailNewIsPending: false,
|
||||||
emailNewErrorMessage: '',
|
emailNewErrorMessage: '',
|
||||||
emailToVerify: '',
|
emailToVerify: '',
|
||||||
|
emailAlreadyExists: false,
|
||||||
|
resendingVerificationEmail: false,
|
||||||
inviteNewErrorMessage: '',
|
inviteNewErrorMessage: '',
|
||||||
inviteNewIsPending: false,
|
inviteNewIsPending: false,
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
|
@ -107,6 +109,7 @@ reducers[ACTIONS.USER_EMAIL_NEW_STARTED] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
emailNewIsPending: true,
|
emailNewIsPending: true,
|
||||||
emailNewErrorMessage: '',
|
emailNewErrorMessage: '',
|
||||||
|
emailAlreadyExists: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.USER_EMAIL_NEW_SUCCESS] = (state, action) => {
|
reducers[ACTIONS.USER_EMAIL_NEW_SUCCESS] = (state, action) => {
|
||||||
|
@ -119,10 +122,9 @@ reducers[ACTIONS.USER_EMAIL_NEW_SUCCESS] = (state, action) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[ACTIONS.USER_EMAIL_NEW_EXISTS] = (state, action) =>
|
reducers[ACTIONS.USER_EMAIL_NEW_EXISTS] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
emailToVerify: action.data.email,
|
emailAlreadyExists: true,
|
||||||
emailNewIsPending: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.USER_EMAIL_NEW_FAILURE] = (state, action) =>
|
reducers[ACTIONS.USER_EMAIL_NEW_FAILURE] = (state, action) =>
|
||||||
|
@ -248,6 +250,21 @@ reducers[ACTIONS.USER_YOUTUBE_IMPORT_FAILURE] = (state, action) =>
|
||||||
youtubeChannelImportErrorMessage: action.data,
|
youtubeChannelImportErrorMessage: action.data,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.USER_EMAIL_VERIFY_RETRY_STARTED] = state =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.USER_EMAIL_VERIFY_RETRY_SUCCESS] = state =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.USER_EMAIL_VERIFY_RETRY_FAILURE] = state =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
resendingVerificationEmail: false,
|
||||||
|
});
|
||||||
|
|
||||||
export function userReducer(state = defaultState, action) {
|
export function userReducer(state = defaultState, action) {
|
||||||
const handler = reducers[action.type];
|
const handler = reducers[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
|
|
|
@ -11,6 +11,16 @@ export const selectUserIsPending = createSelector(selectState, state => state.us
|
||||||
|
|
||||||
export const selectUser = createSelector(selectState, state => state.user);
|
export const selectUser = createSelector(selectState, state => state.user);
|
||||||
|
|
||||||
|
export const selectEmailAlreadyExists = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.emailAlreadyExists
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectResendingVerificationEmail = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.resendingVerificationEmail
|
||||||
|
);
|
||||||
|
|
||||||
export const selectUserEmail = createSelector(
|
export const selectUserEmail = createSelector(
|
||||||
selectUser,
|
selectUser,
|
||||||
user => (user ? user.primary_email : null)
|
user => (user ? user.primary_email : null)
|
||||||
|
|
Loading…
Reference in a new issue