summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/async_client.jsx46
-rw-r--r--webapp/utils/constants.jsx1
2 files changed, 47 insertions, 0 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index d47e45eb9..e1449e3c5 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -1324,6 +1324,29 @@ export function addIncomingHook(hook, success, error) {
);
}
+export function updateIncomingHook(hook, success, error) {
+ Client.updateIncomingHook(
+ hook,
+ (data) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.UPDATED_INCOMING_WEBHOOK,
+ incomingWebhook: data
+ });
+
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ } else {
+ dispatchError(err, 'updateIncomingHook');
+ }
+ }
+ );
+}
+
export function addOutgoingHook(hook, success, error) {
Client.addOutgoingHook(
hook,
@@ -1347,6 +1370,29 @@ export function addOutgoingHook(hook, success, error) {
);
}
+export function updateOutgoingHook(hook, success, error) {
+ Client.updateOutgoingHook(
+ hook,
+ (data) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.UPDATED_OUTGOING_WEBHOOK,
+ outgoingWebhook: data
+ });
+
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ } else {
+ dispatchError(err, 'updateOutgoingHook');
+ }
+ }
+ );
+}
+
export function deleteIncomingHook(id) {
Client.deleteIncomingHook(
id,
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index 130e116a9..68b6f2cc0 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -105,6 +105,7 @@ export const ActionTypes = keyMirror({
RECEIVED_INCOMING_WEBHOOKS: null,
RECEIVED_INCOMING_WEBHOOK: null,
+ UPDATED_INCOMING_WEBHOOK: null,
REMOVED_INCOMING_WEBHOOK: null,
RECEIVED_OUTGOING_WEBHOOKS: null,
RECEIVED_OUTGOING_WEBHOOK: null,