Converting SentryError to a functional component
This commit is contained in:
parent
ea8e4fba08
commit
befcac2087
@ -5,26 +5,22 @@ import { withNamespaces, Trans } from 'react-i18next';
|
||||
|
||||
import Message from 'components/Message';
|
||||
|
||||
export class SentryError extends React.Component {
|
||||
reportError = event => {
|
||||
event.preventDefault();
|
||||
const reportError = event => {
|
||||
event.preventDefault();
|
||||
|
||||
if (Sentry.lastEventId()) {
|
||||
Sentry.showReportDialog();
|
||||
}
|
||||
if (Sentry.lastEventId()) {
|
||||
Sentry.showReportDialog();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { t } = this.props;
|
||||
|
||||
return <Message type="error" heading={ t('An error has occurred') }>
|
||||
<p>
|
||||
<Trans>This error has been logged. You may also <a href="#error-report"
|
||||
onClick={ this.reportError }>fill out a report</a>.</Trans>
|
||||
</p>
|
||||
</Message>;
|
||||
}
|
||||
}
|
||||
export const SentryError = ({ t }) => (
|
||||
<Message type="error" heading={ t('An error has occurred') }>
|
||||
<p>
|
||||
<Trans>This error has been logged. You may also <a href="#error-report"
|
||||
onClick={ reportError }>fill out a report</a>.</Trans>
|
||||
</p>
|
||||
</Message>
|
||||
);
|
||||
|
||||
SentryError.propTypes = {
|
||||
t: PropTypes.func.isRequired
|
||||
|
Loading…
Reference in New Issue
Block a user