summaryrefslogtreecommitdiffstats
path: root/webapp/utils/async_client.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r--webapp/utils/async_client.jsx50
1 files changed, 50 insertions, 0 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index d41b2ddf7..3bbb01d2f 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -1527,3 +1527,53 @@ export function deleteEmoji(id) {
}
);
}
+
+export function saveReaction(channelId, reaction) {
+ Client.saveReaction(
+ channelId,
+ reaction,
+ null, // the added reaction will be sent over the websocket
+ (err) => {
+ dispatchError(err, 'saveReaction');
+ }
+ );
+}
+
+export function deleteReaction(channelId, reaction) {
+ Client.deleteReaction(
+ channelId,
+ reaction,
+ null, // the removed reaction will be sent over the websocket
+ (err) => {
+ dispatchError(err, 'deleteReaction');
+ }
+ );
+}
+
+export function listReactions(channelId, postId) {
+ const callName = 'deleteEmoji' + postId;
+
+ if (isCallInProgress(callName)) {
+ return;
+ }
+
+ callTracker[callName] = utils.getTimestamp();
+
+ Client.listReactions(
+ channelId,
+ postId,
+ (data) => {
+ callTracker[callName] = 0;
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_REACTIONS,
+ postId,
+ reactions: data
+ });
+ },
+ (err) => {
+ callTracker[callName] = 0;
+ dispatchError(err, 'listReactions');
+ }
+ );
+} \ No newline at end of file