From 985aebf86120188c2a14adfab39af7c4da3c1c9d Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Wed, 23 Sep 2015 15:16:48 -0700
Subject: Fixing state setting

---
 web/react/components/admin_console/team_users.jsx | 55 ++++++++++++++++++-----
 1 file changed, 43 insertions(+), 12 deletions(-)

(limited to 'web/react/components/admin_console/team_users.jsx')

diff --git a/web/react/components/admin_console/team_users.jsx b/web/react/components/admin_console/team_users.jsx
index 088a44932..0a971ff15 100644
--- a/web/react/components/admin_console/team_users.jsx
+++ b/web/react/components/admin_console/team_users.jsx
@@ -33,6 +33,14 @@ export default class UserList extends React.Component {
         this.getTeamProfiles(this.props.team.id);
     }
 
+    // this.setState({
+    //     teamId: this.state.teamId,
+    //     users: this.state.users,
+    //     serverError: this.state.serverError,
+    //     showPasswordModal: this.state.showPasswordModal,
+    //     user: this.state.user
+    // });
+
     getTeamProfiles(teamId) {
         Client.getProfilesForTeam(
             teamId,
@@ -56,33 +64,56 @@ export default class UserList extends React.Component {
                     return 0;
                 });
 
-                this.state.users = memberList;
-                this.setState(this.state);
+                this.setState({
+                    teamId: this.state.teamId,
+                    users: memberList,
+                    serverError: this.state.serverError,
+                    showPasswordModal: this.state.showPasswordModal,
+                    user: this.state.user
+                });
             },
             (err) => {
-                this.state.serverError = err.message;
-                this.state.users = null;
-                this.setState(this.state);
+                this.setState({
+                    teamId: this.state.teamId,
+                    users: null,
+                    serverError: err.message,
+                    showPasswordModal: this.state.showPasswordModal,
+                    user: this.state.user
+                });
             }
         );
     }
 
     doPasswordReset(user) {
-        this.state.showPasswordModal = true;
-        this.state.user = user;
-        this.setState(this.state);
+        this.setState({
+            teamId: this.state.teamId,
+            users: this.state.users,
+            serverError: this.state.serverError,
+            showPasswordModal: true,
+            user
+        });
     }
 
     doPasswordResetDismiss() {
         this.state.showPasswordModal = false;
         this.state.user = null;
-        this.setState(this.state);
+        this.setState({
+            teamId: this.state.teamId,
+            users: this.state.users,
+            serverError: this.state.serverError,
+            showPasswordModal: false,
+            user: null
+        });
     }
 
     doPasswordResetSubmit() {
-        this.state.showPasswordModal = false;
-        this.state.user = null;
-        this.setState(this.state);
+        this.setState({
+            teamId: this.state.teamId,
+            users: this.state.users,
+            serverError: this.state.serverError,
+            showPasswordModal: false,
+            user: null
+        });
     }
 
     componentWillReceiveProps(newProps) {
-- 
cgit v1.2.3-1-g7c22

