Move instances of Client.updateChannel() in components to an action (#4643)

* Move instances of Client.updateChannel() in components to an action

* update per code review
Этот коммит содержится в:
Carlos Tadeu Panato Junior
2016-12-01 15:04:33 +01:00
коммит произвёл Joram Wilander
родитель f013d91b89
Коммит 8c18da21f3
2 изменённых файлов: 20 добавлений и 5 удалений

Просмотреть файл

@@ -210,6 +210,24 @@ export function joinChannel(channel, success, error) {
); );
} }
export function updateChannel(channel, success, error) {
Client.updateChannel(
channel,
() => {
AsyncClient.getChannel(channel.id);
if (success) {
success();
}
},
(err) => {
if (error) {
error(err);
}
}
);
}
export function searchMoreChannels(term, success, error) { export function searchMoreChannels(term, success, error) {
Client.searchMoreChannels( Client.searchMoreChannels(
term, term,

Просмотреть файл

@@ -3,11 +3,10 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import * as Utils from 'utils/utils.jsx'; import * as Utils from 'utils/utils.jsx';
import Client from 'client/web_client.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
import Constants from 'utils/constants.jsx'; import Constants from 'utils/constants.jsx';
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl'; import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
import {updateChannel} from 'actions/channel_actions.jsx';
import {Modal} from 'react-bootstrap'; import {Modal} from 'react-bootstrap';
@@ -161,10 +160,8 @@ export class RenameChannelModal extends React.Component {
return; return;
} }
Client.updateChannel( updateChannel(channel,
channel,
() => { () => {
AsyncClient.getChannel(channel.id);
this.handleHide(); this.handleHide();
}, },
(err) => { (err) => {