From 7307156c49b194c4afd946cd9e57715d45b5b21d Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Wed, 26 Apr 2017 15:49:15 -0400
Subject: PLT-6213 Move team store and actions over to use redux (#6222)

* Move team store and actions over to user redux

* Fix JS error when inviting by email
---
 .../admin_console/system_users/system_users.jsx          | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

(limited to 'webapp/components/admin_console/system_users/system_users.jsx')

diff --git a/webapp/components/admin_console/system_users/system_users.jsx b/webapp/components/admin_console/system_users/system_users.jsx
index 7bc4b81ed..29fcd634b 100644
--- a/webapp/components/admin_console/system_users/system_users.jsx
+++ b/webapp/components/admin_console/system_users/system_users.jsx
@@ -16,7 +16,7 @@ import AnalyticsStore from 'stores/analytics_store.jsx';
 import TeamStore from 'stores/team_store.jsx';
 import UserStore from 'stores/user_store.jsx';
 
-import {getAllTeams, getStandardAnalytics, getTeamStats, getUser} from 'utils/async_client.jsx';
+import {getStandardAnalytics} from 'utils/async_client.jsx';
 import {Constants, StatTypes, UserSearchOptions} from 'utils/constants.jsx';
 import {convertTeamMapToList} from 'utils/team_utils.jsx';
 import * as Utils from 'utils/utils.jsx';
@@ -33,6 +33,14 @@ const USER_ID_LENGTH = 26;
 const USERS_PER_PAGE = 50;
 
 export default class SystemUsers extends React.Component {
+    static propTypes = {
+        actions: React.PropTypes.shape({
+            getTeams: React.PropTypes.func.isRequired,
+            getTeamStats: React.PropTypes.func.isRequired,
+            getUser: React.PropTypes.func.isRequired
+        }).isRequired
+    }
+
     constructor(props) {
         super(props);
 
@@ -76,7 +84,7 @@ export default class SystemUsers extends React.Component {
         UserStore.addWithoutTeamChangeListener(this.updateUsersFromStore);
 
         this.loadDataForTeam(this.state.teamId);
-        getAllTeams();
+        this.props.actions.getTeams(0, 1000);
     }
 
     componentWillUpdate(nextProps, nextState) {
@@ -155,7 +163,7 @@ export default class SystemUsers extends React.Component {
             loadProfilesWithoutTeam(0, Constants.PROFILE_CHUNK_SIZE, this.loadComplete);
         } else {
             loadProfilesAndTeamMembers(0, Constants.PROFILE_CHUNK_SIZE, teamId, this.loadComplete);
-            getTeamStats(teamId);
+            this.props.actions.getTeamStats(teamId);
         }
     }
 
@@ -240,7 +248,7 @@ export default class SystemUsers extends React.Component {
             return;
         }
 
-        getUser(
+        this.props.actions.getUser(
             id,
             () => {
                 this.setState({
-- 
cgit v1.2.3-1-g7c22

