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 { PanelBodyHeader } from 'components/ui/Panel';
export default class AuthError extends Component {
static displayName = 'AuthError';
static propTypes = {
error: PropTypes.string.isRequired,
onClose: PropTypes.func
};
render() {
let { error } = this.props;
error = errorsDict.resolve(error);
return (
<PanelBodyHeader type="error" onClose={this.props.onClose}>
{error}
</PanelBodyHeader>
);
}
export default function AuthError({error, onClose = function() {}}) {
return (
<PanelBodyHeader type="error" onClose={onClose}>
{errorsDict.resolve(error)}
</PanelBodyHeader>
);
}
AuthError.displayName = 'AuthError';
AuthError.propTypes = {
error: PropTypes.string.isRequired,
onClose: PropTypes.func
};