Move instances of Client.deleteChannel() in components to an action (#5164)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
a8f35c5738
Коммит
dbfd93daa7
@@ -461,3 +461,23 @@ export function leaveChannel(channelId, success, error) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function deleteChannel(channelId, success, error) {
|
||||||
|
Client.deleteChannel(
|
||||||
|
channelId,
|
||||||
|
() => {
|
||||||
|
loadChannelsForCurrentUser();
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
success();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
AsyncClient.dispatchError(err, 'handleDelete');
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import * as AsyncClient from 'utils/async_client.jsx';
|
|
||||||
import Client from 'client/web_client.jsx';
|
|
||||||
import {Modal} from 'react-bootstrap';
|
import {Modal} from 'react-bootstrap';
|
||||||
import TeamStore from 'stores/team_store.jsx';
|
import TeamStore from 'stores/team_store.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
@@ -13,7 +11,7 @@ import {browserHistory} from 'react-router/es6';
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
import {deleteChannel} from 'actions/channel_actions.jsx';
|
||||||
|
|
||||||
export default class DeleteChannelModal extends React.Component {
|
export default class DeleteChannelModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -31,15 +29,7 @@ export default class DeleteChannelModal extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/town-square');
|
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/town-square');
|
||||||
Client.deleteChannel(
|
deleteChannel(this.props.channel.id);
|
||||||
this.props.channel.id,
|
|
||||||
() => {
|
|
||||||
loadChannelsForCurrentUser();
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
AsyncClient.dispatchError(err, 'handleDelete');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onHide() {
|
onHide() {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user