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/user_settings_security.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/user_settings_security.jsx')
-rw-r--r-- | web/react/components/user_settings_security.jsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/web/react/components/user_settings_security.jsx b/web/react/components/user_settings_security.jsx index d83151cd8..6ccd09cb1 100644 --- a/web/react/components/user_settings_security.jsx +++ b/web/react/components/user_settings_security.jsx @@ -16,8 +16,9 @@ export default class SecurityTab extends React.Component { this.updateNewPassword = this.updateNewPassword.bind(this); this.updateConfirmPassword = this.updateConfirmPassword.bind(this); this.handleClose = this.handleClose.bind(this); + this.setupInitialState = this.setupInitialState.bind(this); - this.state = {currentPassword: '', newPassword: '', confirmPassword: ''}; + this.state = this.setupInitialState(); } submitPassword(e) { e.preventDefault(); @@ -51,10 +52,10 @@ export default class SecurityTab extends React.Component { function success() { this.props.updateSection(''); AsyncClient.getMe(); - this.setState({currentPassword: '', newPassword: '', confirmPassword: ''}); + this.setState(this.setupInitialState()); }.bind(this), function fail(err) { - var state = this.getInitialState(); + var state = this.setupInitialState(); if (err.message) { state.serverError = err.message; } else { @@ -88,6 +89,9 @@ export default class SecurityTab extends React.Component { this.props.updateTab('general'); } + setupInitialState() { + return {currentPassword: '', newPassword: '', confirmPassword: ''}; + } componentDidMount() { $('#user_settings').on('hidden.bs.modal', this.handleClose); } |