summaryrefslogtreecommitdiffstats
path: root/webapp/components/new_channel_flow.jsx
diff options
context:
space:
mode:
authorBjörn Roland <bjoernr-de@users.noreply.github.com>2016-12-22 15:46:34 +0100
committerenahum <nahumhbl@gmail.com>2016-12-22 11:46:34 -0300
commit8a92908dad4f74ac3373d65a361594acb95cf1a0 (patch)
tree1bc822b1fea575f8555be123749a3ee96fcf1960 /webapp/components/new_channel_flow.jsx
parent257a2234c431caf98abb0b9b1791672ae59a17fe (diff)
downloadchat-8a92908dad4f74ac3373d65a361594acb95cf1a0.tar.gz
chat-8a92908dad4f74ac3373d65a361594acb95cf1a0.tar.bz2
chat-8a92908dad4f74ac3373d65a361594acb95cf1a0.zip
#4697 Move Client.createChannel() in components to an action (#4855)
* #4697 Move instances of Client.createChannel() in components to an action
Diffstat (limited to 'webapp/components/new_channel_flow.jsx')
-rw-r--r--webapp/components/new_channel_flow.jsx28
1 files changed, 7 insertions, 21 deletions
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') {