Move instances of Client.updateChannelHeader() in components to an action (#5098)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
a5b5dabf4a
Коммит
8f0175e15c
@@ -321,3 +321,25 @@ export function createChannel(channel, success, error) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateChannelHeader(channelId, header, success, error) {
|
||||||
|
Client.updateChannelHeader(
|
||||||
|
channelId,
|
||||||
|
header,
|
||||||
|
(channelData) => {
|
||||||
|
AppDispatcher.handleServerAction({
|
||||||
|
type: ActionTypes.RECEIVED_CHANNEL,
|
||||||
|
channel: channelData
|
||||||
|
});
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
success(channelData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
if (error) {
|
||||||
|
error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,13 +2,12 @@
|
|||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
|
|
||||||
import Client from 'client/web_client.jsx';
|
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import PreferenceStore from 'stores/preference_store.jsx';
|
import PreferenceStore from 'stores/preference_store.jsx';
|
||||||
|
|
||||||
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
|
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
|
||||||
|
import {updateChannelHeader} from 'actions/channel_actions.jsx';
|
||||||
|
|
||||||
import {Modal} from 'react-bootstrap';
|
import {Modal} from 'react-bootstrap';
|
||||||
|
|
||||||
@@ -64,17 +63,12 @@ class EditChannelHeaderModal extends React.Component {
|
|||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
this.setState({submitted: true});
|
this.setState({submitted: true});
|
||||||
|
|
||||||
Client.updateChannelHeader(
|
updateChannelHeader(
|
||||||
this.props.channel.id,
|
this.props.channel.id,
|
||||||
this.state.header,
|
this.state.header,
|
||||||
(channel) => {
|
() => {
|
||||||
this.setState({serverError: ''});
|
this.setState({serverError: ''});
|
||||||
this.onHide();
|
this.onHide();
|
||||||
|
|
||||||
AppDispatcher.handleServerAction({
|
|
||||||
type: Constants.ActionTypes.RECEIVED_CHANNEL,
|
|
||||||
channel
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err.id === 'api.context.invalid_param.app_error') {
|
if (err.id === 'api.context.invalid_param.app_error') {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user