diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-01-23 15:22:26 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-01-23 09:22:26 -0500 |
commit | dbfd93daa75a0998bc8645245f9cc1ad77f3cadd (patch) | |
tree | 6637a1af89dfaa64cc469f2705890c600b1dc790 /webapp/actions/channel_actions.jsx | |
parent | a8f35c573875c686038d137e1663f0fd87e7f4ae (diff) | |
download | chat-dbfd93daa75a0998bc8645245f9cc1ad77f3cadd.tar.gz chat-dbfd93daa75a0998bc8645245f9cc1ad77f3cadd.tar.bz2 chat-dbfd93daa75a0998bc8645245f9cc1ad77f3cadd.zip |
Move instances of Client.deleteChannel() in components to an action (#5164)
Diffstat (limited to 'webapp/actions/channel_actions.jsx')
-rw-r--r-- | webapp/actions/channel_actions.jsx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx index 340f90fc4..4b4e3e10c 100644 --- a/webapp/actions/channel_actions.jsx +++ b/webapp/actions/channel_actions.jsx @@ -461,3 +461,23 @@ export function leaveChannel(channelId, success, error) { } ); } + +export function deleteChannel(channelId, success, error) { + Client.deleteChannel( + channelId, + () => { + loadChannelsForCurrentUser(); + + if (success) { + success(); + } + }, + (err) => { + AsyncClient.dispatchError(err, 'handleDelete'); + + if (error) { + error(err); + } + } + ); +} |