mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-17 21:53:03 +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 { 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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user