diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-09-02 16:26:43 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-09-02 16:30:27 -0700 |
commit | 97fa0d95b4d26734ce17a489d5e82d7f0298bffb (patch) | |
tree | 555f398dc587ea7f4ec76aba8010a55dd13a9c6c /web/react/components/team_feature_tab.jsx | |
parent | 83788409a2fd5fdcbf9f55e86a73cf83cd9e1763 (diff) | |
download | chat-97fa0d95b4d26734ce17a489d5e82d7f0298bffb.tar.gz chat-97fa0d95b4d26734ce17a489d5e82d7f0298bffb.tar.bz2 chat-97fa0d95b4d26734ce17a489d5e82d7f0298bffb.zip |
Replaced remaining calls of getInitialState
Diffstat (limited to 'web/react/components/team_feature_tab.jsx')
-rw-r--r-- | web/react/components/team_feature_tab.jsx | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/web/react/components/team_feature_tab.jsx b/web/react/components/team_feature_tab.jsx index e5398332e..3251746b8 100644 --- a/web/react/components/team_feature_tab.jsx +++ b/web/react/components/team_feature_tab.jsx @@ -14,15 +14,9 @@ export default class FeatureTab extends React.Component { this.submitValetFeature = this.submitValetFeature.bind(this); this.handleValetRadio = this.handleValetRadio.bind(this); this.onUpdateSection = this.onUpdateSection.bind(this); + this.setupInitialState = this.setupInitialState.bind(this); - this.state = {}; - var team = this.props.team; - - if (team && team.allow_valet) { - this.state.allowValet = 'true'; - } else { - this.state.allowValet = 'false'; - } + this.state = this.setupInitialState(); } componentWillReceiveProps(newProps) { var team = newProps.team; @@ -44,7 +38,7 @@ export default class FeatureTab extends React.Component { AsyncClient.getMyTeam(); }.bind(this), function fail(err) { - var state = this.getInitialState(); + var state = this.setupInitialState(); state.serverError = err; this.setState(state); }.bind(this) @@ -62,6 +56,18 @@ export default class FeatureTab extends React.Component { this.props.updateSection('valet'); } } + setupInitialState() { + var allowValet; + var team = this.props.team; + + if (team && team.allow_valet) { + allowValet = 'true'; + } else { + allowValet = 'false'; + } + + return {allowValet: allowValet}; + } render() { var clientError = null; var serverError = null; |