From 8a92908dad4f74ac3373d65a361594acb95cf1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Roland?= Date: Thu, 22 Dec 2016 15:46:34 +0100 Subject: #4697 Move Client.createChannel() in components to an action (#4855) * #4697 Move instances of Client.createChannel() in components to an action --- webapp/components/new_channel_flow.jsx | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/new_channel_flow.jsx b/webapp/components/new_channel_flow.jsx index b37e6cf35..539dd4d92 100644 --- a/webapp/components/new_channel_flow.jsx +++ b/webapp/components/new_channel_flow.jsx @@ -2,7 +2,6 @@ // See License.txt for license information. import * as Utils from 'utils/utils.jsx'; -import Client from 'client/web_client.jsx'; import TeamStore from 'stores/team_store.jsx'; import UserStore from 'stores/user_store.jsx'; @@ -10,12 +9,9 @@ import NewChannelModal from './new_channel_modal.jsx'; import ChangeURLModal from './change_url_modal.jsx'; import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl'; +import {createChannel} from 'actions/channel_actions.jsx'; import {browserHistory} from 'react-router/es6'; -import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; -import Constants from 'utils/constants.jsx'; -const ActionTypes = Constants.ActionTypes; - const SHOW_NEW_CHANNEL = 1; const SHOW_EDIT_URL = 2; const SHOW_EDIT_URL_THEN_COMPLETE = 3; @@ -106,25 +102,15 @@ class NewChannelFlow extends React.Component { header: this.state.channelHeader, type: this.state.channelType }; - Client.createChannel( + + createChannel( channel, (data) => { - Client.getChannel( - data.id, - (data2) => { - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_CHANNEL, - channel: data2.channel, - member: data2.member - }); - - this.doOnModalExited = () => { - browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + data2.channel.name); - }; + this.doOnModalExited = () => { + browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + data.channel.name); + }; - this.props.onModalDismissed(); - } - ); + this.props.onModalDismissed(); }, (err) => { if (err.id === 'model.channel.is_valid.2_or_more.app_error') { -- cgit v1.2.3-1-g7c22