Convert AuthError into stateless component

This commit is contained in:
SleepWalker 2016-05-02 11:06:25 +03:00
parent b5c31078fc
commit 5adfc60783

View File

@ -1,25 +1,18 @@
import React, { Component, PropTypes } from 'react'; import React, { PropTypes } from 'react';
import errorsDict from 'services/errorsDict'; import errorsDict from 'services/errorsDict';
import { PanelBodyHeader } from 'components/ui/Panel'; import { PanelBodyHeader } from 'components/ui/Panel';
export default class AuthError extends Component { export default function AuthError({error, onClose = function() {}}) {
static displayName = 'AuthError'; return (
<PanelBodyHeader type="error" onClose={onClose}>
static propTypes = { {errorsDict.resolve(error)}
error: PropTypes.string.isRequired, </PanelBodyHeader>
onClose: PropTypes.func );
};
render() {
let { error } = this.props;
error = errorsDict.resolve(error);
return (
<PanelBodyHeader type="error" onClose={this.props.onClose}>
{error}
</PanelBodyHeader>
);
}
} }
AuthError.displayName = 'AuthError';
AuthError.propTypes = {
error: PropTypes.string.isRequired,
onClose: PropTypes.func
};