diff options
author | Poornima <mpoornima@users.noreply.github.com> | 2017-02-27 00:18:20 +0530 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-02-26 13:48:20 -0500 |
commit | 19b753467d37209f2227567637e60138d05dd405 (patch) | |
tree | 163ba0878c02267ecbbcb288e11d23e30ec9c8eb /webapp/utils/async_client.jsx | |
parent | c0bb6f99f89259f6728856ace23d5dd505494b26 (diff) | |
download | chat-19b753467d37209f2227567637e60138d05dd405.tar.gz chat-19b753467d37209f2227567637e60138d05dd405.tar.bz2 chat-19b753467d37209f2227567637e60138d05dd405.zip |
Adding edit of incoming webhook (#5272)
Adding edit of outgoing webhook
Fixing spelling of error
Fixing style
Changing from PUT to POST for updates
Fixing test failures due to merge
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r-- | webapp/utils/async_client.jsx | 46 |
1 files changed, 46 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, |