#4697 Move Client.createChannel() in components to an action (#4855)

* #4697 Move instances of Client.createChannel() in components to an action
Этот коммит содержится в:
Björn Roland
2016-12-22 15:46:34 +01:00
коммит произвёл enahum
родитель 257a2234c4
Коммит 8a92908dad
2 изменённых файлов: 43 добавлений и 21 удалений

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

@@ -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);
}
}
);
}