Created
January 5, 2018 10:48
-
-
Save fernandocamargo/7ea557bac0f0d08f8a0caae6d55f21e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const selectActivationStatus = createSelector( | |
selectActivationInProgress, | |
selectResendActivationInProgress, | |
selectActivationError, | |
selectResendActivationError, | |
selectActivationSuccess, | |
selectResendActivationSuccess, | |
( | |
activateInProgress, | |
resendInProgress, | |
activateError, | |
resendError, | |
activateSuccess, | |
resendSuccess, | |
) => { | |
switch (true) { | |
case (resendInProgress || activateInProgress): | |
return PENDING; | |
case resendSuccess: | |
return RESEND_SUCCESS; | |
case activateSuccess: | |
return SUCCESS; | |
case resendError: | |
return errorConstantToUserActivationStatus(resendError); | |
case activateError: | |
return errorConstantToUserActivationStatus(activateError); | |
default: | |
return; | |
} | |
}, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const selectActivationStatus = createSelector( | |
selectActivationInProgress, | |
selectResendActivationInProgress, | |
selectActivationError, | |
selectResendActivationError, | |
selectActivationSuccess, | |
selectResendActivationSuccess, | |
( | |
activateInProgress, | |
resendInProgress, | |
activateError, | |
resendError, | |
activateSuccess, | |
resendSuccess, | |
) => { | |
if (resendInProgress || activateInProgress) return PENDING; | |
if (resendSuccess) return RESEND_SUCCESS; | |
if (activateSuccess) return SUCCESS; | |
if (resendError) { | |
return errorConstantToUserActivationStatus(resendError); | |
} | |
if (activateError) { | |
return errorConstantToUserActivationStatus(activateError); | |
} | |
return undefined; | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment