aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/util
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-12-09 20:48:25 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-12-09 20:48:25 +0100
commit5d6164973e92fa8a3e3c18a0eb2e29494aea4f48 (patch)
tree382e6c672bbc0f7582b3b627b02111dcce902894 /src/components/util
parentAdd React 16 didCatch/ErrorBoundary component (diff)
downloadferdium-app-5d6164973e92fa8a3e3c18a0eb2e29494aea4f48.tar.gz
ferdium-app-5d6164973e92fa8a3e3c18a0eb2e29494aea4f48.tar.zst
ferdium-app-5d6164973e92fa8a3e3c18a0eb2e29494aea4f48.zip
Fix linting issues
Diffstat (limited to 'src/components/util')
-rw-r--r--src/components/util/ErrorBoundary/index.js18
-rw-r--r--src/components/util/ErrorBoundary/styles.js4
2 files changed, 14 insertions, 8 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 @@
1import React, { Component } from 'react'; 1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
2import injectSheet from 'react-jss'; 3import injectSheet from 'react-jss';
3import { defineMessages, intlShape } from 'react-intl'; 4import { defineMessages, intlShape } from 'react-intl';
4 5
5import Button from '../../ui/Button'; 6import Button from '../../ui/Button';
6 7
7import styles from './styles'; 8import 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}
diff --git a/src/components/util/ErrorBoundary/styles.js b/src/components/util/ErrorBoundary/styles.js
index 8d62767f6..0960546ff 100644
--- a/src/components/util/ErrorBoundary/styles.js
+++ b/src/components/util/ErrorBoundary/styles.js
@@ -1,4 +1,4 @@
1export default (theme) => ({ 1export default theme => ({
2 component: { 2 component: {
3 display: 'flex', 3 display: 'flex',
4 width: '100%', 4 width: '100%',
@@ -9,5 +9,5 @@ export default (theme) => ({
9 title: { 9 title: {
10 fontSize: 20, 10 fontSize: 20,
11 color: theme.colorText, 11 color: theme.colorText,
12 } 12 },
13}); 13});