Improve error boundary styles, provide way to clear browser data
This commit is contained in:
@@ -22,6 +22,11 @@ export default class ErrorBoundary extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
clearCookies = e => {
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { hasError } = this.state;
|
||||
|
||||
@@ -32,8 +37,26 @@ export default class ErrorBoundary extends React.PureComponent {
|
||||
return (
|
||||
<div className='error-boundary'>
|
||||
<div>
|
||||
<i className='fa fa-frown-o' aria-hidden='true' />
|
||||
<FormattedMessage id='alert.unexpected.message' defaultMessage='An unexpected error occurred.' />
|
||||
<a href='/'>Return Home</a>
|
||||
<a href='/' className='return-home'>
|
||||
<i className='fa fa-reply' aria-hidden='true' />
|
||||
<FormattedMessage id='alert.unexpected.return_home' defaultMessage='Return Home' />
|
||||
</a>
|
||||
<p className='help-text'>
|
||||
<FormattedMessage
|
||||
id='alert.unexpected.help_text'
|
||||
defaultMessage='If the problem persists, please notify a site admin with a screenshot and information about your web browser. You may also {clear_cookies} (this will log you out).'
|
||||
values={{ clear_cookies: (
|
||||
<a href='/' onClick={this.clearCookies}>
|
||||
<FormattedMessage
|
||||
id='alert.unexpected.clear_cookies'
|
||||
defaultMessage='clear cookies and browser data'
|
||||
/>
|
||||
</a>
|
||||
) }}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user