Skip to content
This repository was archived by the owner on Feb 18, 2021. It is now read-only.

Commit 2a978fe

Browse files
committed
refactor(mail-box): remove duplications
1 parent 62b6050 commit 2a978fe

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/renderer/components/MailBox/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,19 @@ export default class MailBox extends React.Component {
2222
}
2323

2424
componentDidMount() {
25-
this.props.displayWebview({ darkTheme: this.props.darkTheme });
25+
this.handleDisplayWebview();
2626
}
2727

2828
componentDidUpdate(prevProps) {
2929
if (this.props.error) {
3030
this.props.hideWebviews();
3131
} else {
3232
if (this.props.username !== prevProps.username) {
33-
this.props.displayWebview({
34-
darkTheme: this.props.darkTheme,
35-
});
33+
this.handleDisplayWebview();
3634
}
3735

3836
if (prevProps.error !== this.props.error) {
39-
this.props.displayWebview({
40-
darkTheme: this.props.darkTheme,
41-
});
37+
this.handleDisplayWebview();
4238
}
4339
}
4440
}
@@ -51,6 +47,12 @@ export default class MailBox extends React.Component {
5147
*/
5248
}
5349

50+
handleDisplayWebview() {
51+
this.props.displayWebview({
52+
darkTheme: this.props.darkTheme,
53+
});
54+
}
55+
5456
handleReload() {
5557
this.props.onReload(this.props.username);
5658
}

0 commit comments

Comments
 (0)