// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. const UserStore = require('../stores/user_store.jsx'); const Client = require('../utils/client.jsx'); const AsyncClient = require('../utils/async_client.jsx'); const Utils = require('../utils/utils.jsx'); export default class MemberListTeamItem extends React.Component { constructor(props) { super(props); this.handleMakeMember = this.handleMakeMember.bind(this); this.handleMakeActive = this.handleMakeActive.bind(this); this.handleMakeNotActive = this.handleMakeNotActive.bind(this); this.handleMakeAdmin = this.handleMakeAdmin.bind(this); this.state = {}; } handleMakeMember() { const data = { user_id: this.props.user.id, new_roles: '' }; Client.updateRoles(data, function handleMakeMemberSuccess() { AsyncClient.getProfiles(); }, function handleMakeMemberError(err) { this.setState({serverError: err.message}); }.bind(this) ); } handleMakeActive() { Client.updateActive(this.props.user.id, true, function handleMakeActiveSuccess() { AsyncClient.getProfiles(); }, function handleMakeActiveError(err) { this.setState({serverError: err.message}); }.bind(this) ); } handleMakeNotActive() { Client.updateActive(this.props.user.id, false, function handleMakeNotActiveSuccess() { AsyncClient.getProfiles(); }, function handleMakeNotActiveError(err) { this.setState({serverError: err.message}); }.bind(this) ); } handleMakeAdmin() { const data = { user_id: this.props.user.id, new_roles: 'admin' }; Client.updateRoles(data, function handleMakeAdminSuccess() { AsyncClient.getProfiles(); }, function handleMakeAdmitError(err) { this.setState({serverError: err.message}); }.bind(this) ); } render() { let serverError = null; if (this.state.serverError) { serverError = (