diff options
author | 2018-12-09 20:48:25 +0100 | |
---|---|---|
committer | 2018-12-09 20:48:25 +0100 | |
commit | 5d6164973e92fa8a3e3c18a0eb2e29494aea4f48 (patch) | |
tree | 382e6c672bbc0f7582b3b627b02111dcce902894 /src/components/util/ErrorBoundary/index.js | |
parent | Add React 16 didCatch/ErrorBoundary component (diff) | |
download | ferdium-app-5d6164973e92fa8a3e3c18a0eb2e29494aea4f48.tar.gz ferdium-app-5d6164973e92fa8a3e3c18a0eb2e29494aea4f48.tar.zst ferdium-app-5d6164973e92fa8a3e3c18a0eb2e29494aea4f48.zip |
Fix linting issues
Diffstat (limited to 'src/components/util/ErrorBoundary/index.js')
-rw-r--r-- | src/components/util/ErrorBoundary/index.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/components/util/ErrorBoundary/index.js b/src/components/util/ErrorBoundary/index.js index def01c74f..5db0db226 100644 --- a/src/components/util/ErrorBoundary/index.js +++ b/src/components/util/ErrorBoundary/index.js | |||
@@ -1,8 +1,9 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | ||
2 | import injectSheet from 'react-jss'; | 3 | import injectSheet from 'react-jss'; |
3 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, intlShape } from 'react-intl'; |
4 | 5 | ||
5 | import Button from '../../ui/Button'; | 6 | import Button from '../../ui/Button'; |
6 | 7 | ||
7 | import styles from './styles'; | 8 | import styles from './styles'; |
8 | 9 | ||
@@ -22,16 +23,21 @@ export default @injectSheet(styles) class ErrorBoundary extends Component { | |||
22 | hasError: false, | 23 | hasError: false, |
23 | } | 24 | } |
24 | 25 | ||
26 | static propTypes = { | ||
27 | classes: PropTypes.object.isRequired, | ||
28 | children: PropTypes.node.isRequired, | ||
29 | } | ||
30 | |||
25 | static contextTypes = { | 31 | static contextTypes = { |
26 | intl: intlShape, | 32 | intl: intlShape, |
27 | }; | 33 | }; |
28 | 34 | ||
29 | componentDidCatch(error, info) { | 35 | componentDidCatch() { |
30 | this.setState({ hasError: true }); | 36 | this.setState({ hasError: true }); |
31 | } | 37 | } |
32 | 38 | ||
33 | render() { | 39 | render() { |
34 | const { classes } = this.props; | 40 | const { classes } = this.props; |
35 | const { intl } = this.context; | 41 | const { intl } = this.context; |
36 | 42 | ||
37 | if (this.state.hasError) { | 43 | if (this.state.hasError) { |
@@ -40,10 +46,10 @@ export default @injectSheet(styles) class ErrorBoundary extends Component { | |||
40 | <h1 className={classes.title}> | 46 | <h1 className={classes.title}> |
41 | {intl.formatMessage(messages.headline)} | 47 | {intl.formatMessage(messages.headline)} |
42 | </h1> | 48 | </h1> |
43 | <Button | 49 | <Button |
44 | label={intl.formatMessage(messages.action)} | 50 | label={intl.formatMessage(messages.action)} |
45 | buttonType="inverted" | 51 | buttonType="inverted" |
46 | onClick={() => location.reload()} | 52 | onClick={() => window.location.reload()} |
47 | /> | 53 | /> |
48 | </div> | 54 | </div> |
49 | ); | 55 | ); |
@@ -51,4 +57,4 @@ export default @injectSheet(styles) class ErrorBoundary extends Component { | |||
51 | 57 | ||
52 | return this.props.children; | 58 | return this.props.children; |
53 | } | 59 | } |
54 | } \ No newline at end of file | 60 | } |