mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-29 00:10:54 +05:30
Convert AuthError into stateless component
This commit is contained in:
parent
b5c31078fc
commit
5adfc60783
@ -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
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user