#102: countdown for email frequency error in ResendActivation

This commit is contained in:
SleepWalker 2016-05-28 22:46:32 +03:00
parent 25eeac6074
commit 9fa7cd7b8e
2 changed files with 4 additions and 6 deletions

View File

@ -14,12 +14,8 @@ export default function AuthError({error, onClose = function() {}}) {
resetTimer();
if (error.payload && error.payload.canRepeatIn) {
if (error.payload && error.payload.canRepeatIn) {
error.payload.msLeft = error.payload.canRepeatIn * 1000;
setTimeout(onClose, error.payload.msLeft - Date.now() + 1500); // 1500 to let the user see, that time is elapsed
} else {
// TODO: it would be greate to log this case, when we will setup frontend logging
}
error.payload.msLeft = error.payload.canRepeatIn * 1000;
setTimeout(onClose, error.payload.msLeft - Date.now() + 1500); // 1500 to let the user see, that time is elapsed
}
return (

View File

@ -70,8 +70,10 @@ const errorsMap = {
'error.account_not_activated': () => <Message {...messages.accountNotActivated} />,
'error.email_frequency': (props) => <Message {...messages.emailFrequency} values={{
// for msLeft @see AuthError.jsx
time: <Relative value={props.msLeft} updateInterval={1000} />
}} />,
'error.recently_sent_message': (props) => errorsMap['error.email_frequency'](props),
'error.email_not_found': () => <Message {...messages.emailNotFound} />,
'error.account_already_activated': () => <Message {...messages.accountAlreadyActivated} />,