From 3246d97d5ea00320f9d051318321e156eb0130a0 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Mon, 28 Mar 2016 09:41:03 -0400
Subject: Added basic screen to add incoming webhooks

---
 webapp/utils/async_client.jsx | 46 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

(limited to 'webapp/utils/async_client.jsx')

diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index 2154fbe43..9ca2bd606 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -1167,3 +1167,49 @@ export function listOutgoingHooks() {
         }
     );
 }
+
+export function addIncomingHook(hook, success, error) {
+    client.addIncomingHook(
+        hook,
+        (data) => {
+            AppDispatcher.handleServerAction({
+                type: ActionTypes.RECEIVED_INCOMING_WEBHOOK,
+                incomingWebhook: data
+            });
+
+            if (success) {
+                success();
+            }
+        },
+        (err) => {
+            dispatchError(err, 'addIncomingHook');
+
+            if (error) {
+                error(err);
+            }
+        }
+    );
+}
+
+export function addOutgoingHook(hook, success, error) {
+    client.addOutgoingHook(
+        hook,
+        (data) => {
+            AppDispatcher.handleServerAction({
+                type: ActionTypes.RECEIVED_OUTGOING_WEBHOOK,
+                outgoingWebhook: data
+            });
+
+            if (success) {
+                success();
+            }
+        },
+        (err) => {
+            dispatchError(err, 'addOutgoingHook');
+
+            if (error) {
+                error(err);
+            }
+        }
+    );
+}
-- 
cgit v1.2.3-1-g7c22

