From d7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Mon, 8 Feb 2016 07:26:10 -0500
Subject: Convering client to react-router.

---
 web/react/components/team_members_modal.jsx | 32 +++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

(limited to 'web/react/components/team_members_modal.jsx')

diff --git a/web/react/components/team_members_modal.jsx b/web/react/components/team_members_modal.jsx
index 9bdb16438..786e8f947 100644
--- a/web/react/components/team_members_modal.jsx
+++ b/web/react/components/team_members_modal.jsx
@@ -10,8 +10,36 @@ import {FormattedMessage} from 'mm-intl';
 const Modal = ReactBootstrap.Modal;
 
 export default class TeamMembersModal extends React.Component {
+    constructor(props) {
+        super(props);
+
+        this.teamChanged = this.teamChanged.bind(this);
+
+        this.state = {
+            team: TeamStore.getCurrent()
+        };
+    }
+    componentDidMount() {
+        if (this.props.show) {
+            this.onShow();
+        }
+
+        TeamStore.addChangeListener(this.teamChanged);
+    }
+
+    componentWillUnmount() {
+        TeamStore.removeChangeListener(this.teamChanged);
+    }
+
+    teamChanged() {
+        this.setState({team: TeamStore.getCurrent()});
+    }
+
     render() {
-        const team = TeamStore.getCurrent();
+        let teamDisplayName = '';
+        if (this.state.team) {
+            teamDisplayName = this.state.team.display_name;
+        }
 
         let maxHeight = 1000;
         if (Utils.windowHeight() <= 1200) {
@@ -29,7 +57,7 @@ export default class TeamMembersModal extends React.Component {
                         id='team_member_modal.members'
                         defaultMessage='{team} Members'
                         values={{
-                            team: team.display_name
+                            team: teamDisplayName
                         }}
                     />
                 </Modal.Header>
-- 
cgit v1.2.3-1-g7c22

