// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. var Client =require('../utils/client.jsx'); var AsyncClient =require('../utils/async_client.jsx'); var ChannelStore =require('../stores/channel_store.jsx') module.exports = React.createClass({ handleDelete: function(e) { if (this.state.channel_id.length != 26) return; Client.deleteChannel(this.state.channel_id, function(data) { AsyncClient.getChannels(true); window.location.href = '/channels/town-square'; }.bind(this), function(err) { AsyncClient.dispatchError(err, "handleDelete"); }.bind(this) ); }, componentDidMount: function() { var self = this; $(this.refs.modal.getDOMNode()).on('show.bs.modal', function(e) { var button = $(e.relatedTarget); self.setState({ title: button.attr('data-title'), channel_id: button.attr('data-channelid') }); }); }, getInitialState: function() { return { title: "", channel_id: "" }; }, render: function() { var channelType = ChannelStore.getCurrent() && ChannelStore.getCurrent().type === 'P' ? "private group" : "channel" return ( ); } });