// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import * as AsyncClient from 'utils/async_client.jsx';
import Client from 'utils/web_client.jsx';
import {Modal} from 'react-bootstrap';
import TeamStore from 'stores/team_store.jsx';
import Constants from 'utils/constants.jsx';
import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router/es6';
import React from 'react';
export default class DeleteChannelModal extends React.Component {
constructor(props) {
super(props);
this.handleDelete = this.handleDelete.bind(this);
}
handleDelete() {
if (this.props.channel.id.length !== 26) {
return;
}
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/town-square');
Client.deleteChannel(
this.props.channel.id,
() => {
AsyncClient.getChannels(true);
},
(err) => {
AsyncClient.dispatchError(err, 'handleDelete');
}
);
}
render() {
let channelTerm = (
);
if (this.props.channel.type === Constants.PRIVATE_CHANNEL) {
channelTerm = (
);
}
return (
);
}
}
DeleteChannelModal.propTypes = {
show: React.PropTypes.bool.isRequired,
onHide: React.PropTypes.func.isRequired,
channel: React.PropTypes.object.isRequired
};