diff options
Diffstat (limited to 'webapp/actions/team_actions.jsx')
-rw-r--r-- | webapp/actions/team_actions.jsx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/webapp/actions/team_actions.jsx b/webapp/actions/team_actions.jsx index 3bf25c193..e0403529e 100644 --- a/webapp/actions/team_actions.jsx +++ b/webapp/actions/team_actions.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. import UserStore from 'stores/user_store.jsx'; +import TeamStore from 'stores/team_store.jsx'; import Constants from 'utils/constants.jsx'; const ActionTypes = Constants.ActionTypes; @@ -19,8 +20,6 @@ export function checkIfTeamExists(teamName, onSuccess, onError) { export function createTeam(team, onSuccess, onError) { Client.createTeam(team, (rteam) => { - AsyncClient.getDirectProfiles(); - AppDispatcher.handleServerAction({ type: ActionTypes.CREATED_TEAM, team: rteam, @@ -36,3 +35,25 @@ export function createTeam(team, onSuccess, onError) { onError ); } + +export function removeUserFromTeam(teamId, userId, success, error) { + Client.removeUserFromTeam( + teamId, + userId, + () => { + TeamStore.removeMemberInTeam(teamId, userId); + AsyncClient.getUser(userId); + + if (success) { + success(); + } + }, + (err) => { + AsyncClient.dispatchError(err, 'removeUserFromTeam'); + + if (error) { + error(err); + } + } + ); +} |