// 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, () => { AsyncClient.getProfiles(); }, (err) => { this.setState({serverError: err.message}); } ); } handleMakeActive() { Client.updateActive(this.props.user.id, true, () => { AsyncClient.getProfiles(); }, (err) => { this.setState({serverError: err.message}); } ); } handleMakeNotActive() { Client.updateActive(this.props.user.id, false, () => { AsyncClient.getProfiles(); }, (err) => { this.setState({serverError: err.message}); } ); } handleMakeAdmin() { const data = { user_id: this.props.user.id, new_roles: 'admin' }; Client.updateRoles(data, () => { AsyncClient.getProfiles(); }, (err) => { this.setState({serverError: err.message}); } ); } render() { let serverError = null; if (this.state.serverError) { serverError = (