@@ -212,6 +212,14 @@ function onDeletePhotoDone(state, { payload, error }) {
212
212
function onUpdateProfileDone ( state , { payload, error } ) {
213
213
const newState = { ...state , updatingProfile : false } ;
214
214
215
+ if ( payload . isEmailConflict ) {
216
+ return {
217
+ ...newState ,
218
+ isEmailConflict : true ,
219
+ updateProfileSuccess : false ,
220
+ } ;
221
+ }
222
+
215
223
if ( error ) {
216
224
logger . error ( 'Failed to update user profile' , payload ) ;
217
225
fireErrorMessage ( 'ERROR: Failed to update user profile!' ) ;
@@ -455,6 +463,19 @@ function onVerifyMemberNewEmailDone(state, { payload, error }) {
455
463
} ;
456
464
}
457
465
466
+ /**
467
+ * Handles UPDATE_EMAIL_CONFLICT action
468
+ * @param {Object } state
469
+ * @param {Object } action Payload will be a boolean value
470
+ * @return {Object } New state
471
+ */
472
+ function onUpdateEmailConflict ( state , { payload } ) {
473
+ return {
474
+ ...state ,
475
+ isEmailConflict : payload ,
476
+ } ;
477
+ }
478
+
458
479
/**
459
480
* Creates a new Profile reducer with the specified initial state.
460
481
* @param {Object } initialState Optional. Initial state.
@@ -509,6 +530,7 @@ function create(initialState) {
509
530
[ a . updatePasswordDone ] : onUpdatePasswordDone ,
510
531
[ a . verifyMemberNewEmailInit ] : state => ( { ...state , verifyingEmail : true } ) ,
511
532
[ a . verifyMemberNewEmailDone ] : onVerifyMemberNewEmailDone ,
533
+ [ a . updateEmailConflict ] : onUpdateEmailConflict ,
512
534
} , _ . defaults ( initialState , {
513
535
achievements : null ,
514
536
copilot : false ,
0 commit comments