diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-07-24 11:40:42 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-07-24 11:40:42 -0400 |
commit | 4f9c40e60b31936977da357214bf1b9fd99a68d7 (patch) | |
tree | bf79e07b3eed37b8ab204f9258db5c7c4ee8a32a /web/react/components/rename_team_modal.jsx | |
parent | b813234f4cc38e72bb94556d3a4acdcde5071468 (diff) | |
parent | dbbe40e893419d78e23b0d73c8bd6a30478cde2c (diff) | |
download | chat-4f9c40e60b31936977da357214bf1b9fd99a68d7.tar.gz chat-4f9c40e60b31936977da357214bf1b9fd99a68d7.tar.bz2 chat-4f9c40e60b31936977da357214bf1b9fd99a68d7.zip |
Merge pull request #226 from nickago/MM-1546
MM-1546 Clear error messages on modal close and channel switch
Diffstat (limited to 'web/react/components/rename_team_modal.jsx')
-rw-r--r-- | web/react/components/rename_team_modal.jsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/web/react/components/rename_team_modal.jsx b/web/react/components/rename_team_modal.jsx index a6da57b67..dfd775a3b 100644 --- a/web/react/components/rename_team_modal.jsx +++ b/web/react/components/rename_team_modal.jsx @@ -44,11 +44,14 @@ module.exports = React.createClass({ onNameChange: function() { this.setState({ name: this.refs.name.getDOMNode().value }) }, + handleClose: function() { + this.setState({ name: this.props.teamDisplayName, name_error: "", server_error: ""}); + }, componentDidMount: function() { - var self = this; - $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function(e) { - self.setState({ name: self.props.teamDisplayName }); - }); + $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', this.handleClose); + }, + componentWillUnmount: function() { + $(this.refs.modal.getDOMNode()).off('hidden.bs.modal', this.handleClose); }, getInitialState: function() { return { name: this.props.teamDisplayName }; |