import React from 'react';
import { FormattedMessage as Message, FormattedRelative as Relative } from 'react-intl';
import { Link } from 'react-router';
import messages from './errorsDict.intl.json';
export default {
resolve(error) {
let payload = {};
if (error.type) {
payload = error.payload || {};
error = error.type;
}
return errorsMap[error] ? errorsMap[error](payload) : error;
}
};
const errorsMap = {
'error.login_required': () => ,
'error.login_not_exist': () => ,
'error.password_required': () => ,
'error.password_invalid': () => ,
'error.old_hash_strategy': () => ,
'error.password_incorrect': (props) => (
{props.isGuest ? errorsMap.suggestResetPassword() : null}
),
'error.username_required': () => ,
'error.username_invalid': () => ,
'error.username_too_short': () => ,
'error.username_too_long': () => ,
'error.username_not_available': () => ,
'error.email_required': () => ,
'error.email_too_long': () => ,
'error.email_invalid': () => ,
'error.email_is_tempmail': () => ,
'error.email_not_available': (props) => (
{props.isGuest ? errorsMap.suggestResetPassword() : null}
),
'error.rePassword_required': () => ,
'error.password_too_short': () => ,
'error.rePassword_does_not_match': () => ,
'error.rulesAgreement_required': () => ,
'error.you_must_accept_rules': () => errorsMap['error.rulesAgreement_required'](),
'error.key_required': () => ,
'error.key_is_required': () => errorsMap['error.key_required'](),
'error.key_not_exists': (props) => (
{props.repeatUrl ? errorsMap.resendKey(props.repeatUrl) : null}
),
'error.key_expire': (props) => errorsMap['error.key_not_exists'](props),
'error.newPassword_required': () => ,
'error.newRePassword_required': () => ,
'error.newRePassword_does_not_match': () => ,
'error.account_not_activated': () => ,
'error.email_frequency': (props) =>
}} />,
'error.email_not_found': () => ,
'error.account_already_activated': () => ,
suggestResetPassword: () => (
)
}} />
),
resendKey: (url) => (
{' '}
)
};