diff options
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r-- | webapp/utils/async_client.jsx | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 9ba853238..1fc19b5f2 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -137,7 +137,7 @@ export function getMyChannelMembers() { (err) => { callTracker.getMyChannelMembers = 0; dispatchError(err, 'getMyChannelMembers'); - reject(); + reject(new Error('Unable to getMyChannelMembers')); } ); }); @@ -166,7 +166,7 @@ export function getMyChannelMembersForTeam(teamId) { (err) => { callTracker[`getMyChannelMembers${teamId}`] = 0; dispatchError(err, 'getMyChannelMembersForTeam'); - reject(); + reject(new Error('Unable to getMyChannelMembersForTeam')); } ); }); @@ -308,7 +308,7 @@ export function getChannelMember(channelId, userId) { (err) => { callTracker[`getChannelMember${channelId}${userId}`] = 0; dispatchError(err, 'getChannelMember'); - reject(); + reject(new Error('Unable to getChannelMeber')); } ); }); @@ -1612,6 +1612,40 @@ export function deleteEmoji(id) { ); } +export function pinPost(channelId, reaction) { + Client.pinPost( + channelId, + reaction, + () => { + // the "post_edited" websocket event take cares of updating the posts + // the action below is mostly dispatched for the RHS to update + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_POST_PINNED + }); + }, + (err) => { + dispatchError(err, 'pinPost'); + } + ); +} + +export function unpinPost(channelId, reaction) { + Client.unpinPost( + channelId, + reaction, + () => { + // the "post_edited" websocket event take cares of updating the posts + // the action below is mostly dispatched for the RHS to update + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_POST_UNPINNED + }); + }, + (err) => { + dispatchError(err, 'unpinPost'); + } + ); +} + export function saveReaction(channelId, reaction) { Client.saveReaction( channelId, |