summaryrefslogtreecommitdiffstats
path: root/webapp/actions/channel_actions.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/actions/channel_actions.jsx')
-rw-r--r--webapp/actions/channel_actions.jsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx
index 952c8ada3..204e6f9f1 100644
--- a/webapp/actions/channel_actions.jsx
+++ b/webapp/actions/channel_actions.jsx
@@ -275,3 +275,39 @@ export function updateChannelNotifyProps(data, success, error) {
}
);
}
+
+export function createChannel(channel, success, error) {
+ Client.createChannel(
+ channel,
+ (data) => {
+ Client.getChannel(
+ data.id,
+ (data2) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_CHANNEL,
+ channel: data2.channel,
+ member: data2.channel
+ });
+
+ if (success) {
+ success(data2);
+ }
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'getChannel');
+
+ if (error) {
+ error(err);
+ }
+ }
+ );
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'createChannel');
+
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}