summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-03-28 09:41:03 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2016-03-29 15:18:26 -0400
commit3246d97d5ea00320f9d051318321e156eb0130a0 (patch)
tree6bca338fe860c76ef00f540f5848cfb3010f93f1 /webapp/utils
parentdcdea9f30b419eeb8d55ed9be3f824aaf27de50c (diff)
downloadchat-3246d97d5ea00320f9d051318321e156eb0130a0.tar.gz
chat-3246d97d5ea00320f9d051318321e156eb0130a0.tar.bz2
chat-3246d97d5ea00320f9d051318321e156eb0130a0.zip
Added basic screen to add incoming webhooks
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/async_client.jsx46
1 files changed, 46 insertions, 0 deletions
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);
+ }
+ }
+ );
+}