diff options
Diffstat (limited to 'webapp/actions/channel_actions.jsx')
-rw-r--r-- | webapp/actions/channel_actions.jsx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx index 5003d6530..ae32a481b 100644 --- a/webapp/actions/channel_actions.jsx +++ b/webapp/actions/channel_actions.jsx @@ -191,3 +191,55 @@ export function loadChannelsForCurrentUser() { AsyncClient.getChannels(); AsyncClient.getMyChannelMembers(); } + +export function joinChannel(channel, success, error) { + Client.joinChannel( + channel.id, + () => { + ChannelStore.removeMoreChannel(channel.id); + + if (success) { + success(); + } + }, + () => { + if (error) { + error(); + } + } + ); +} + +export function searchMoreChannels(term, success, error) { + Client.searchMoreChannels( + term, + (data) => { + if (success) { + success(data); + } + }, + (err) => { + if (error) { + error(err); + } + } + ); +} + +export function autocompleteChannels(term, success, error) { + Client.autocompleteChannels( + term, + (data) => { + if (success) { + success(data); + } + }, + (err) => { + AsyncClient.dispatchError(err, 'autocompleteChannels'); + + if (error) { + error(err); + } + } + ); +} |