diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-28 09:41:03 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-29 15:18:26 -0400 |
commit | 3246d97d5ea00320f9d051318321e156eb0130a0 (patch) | |
tree | 6bca338fe860c76ef00f540f5848cfb3010f93f1 /webapp/stores/integration_store.jsx | |
parent | dcdea9f30b419eeb8d55ed9be3f824aaf27de50c (diff) | |
download | chat-3246d97d5ea00320f9d051318321e156eb0130a0.tar.gz chat-3246d97d5ea00320f9d051318321e156eb0130a0.tar.bz2 chat-3246d97d5ea00320f9d051318321e156eb0130a0.zip |
Added basic screen to add incoming webhooks
Diffstat (limited to 'webapp/stores/integration_store.jsx')
-rw-r--r-- | webapp/stores/integration_store.jsx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/webapp/stores/integration_store.jsx b/webapp/stores/integration_store.jsx index 4e9212bcb..b875c29e6 100644 --- a/webapp/stores/integration_store.jsx +++ b/webapp/stores/integration_store.jsx @@ -4,7 +4,6 @@ import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; import Constants from 'utils/constants.jsx'; import EventEmitter from 'events'; -import * as Utils from 'utils/utils.jsx'; const ActionTypes = Constants.ActionTypes; @@ -44,10 +43,14 @@ class IntegrationStore extends EventEmitter { } setIncomingWebhooks(incomingWebhooks) { - this.incomingWebhooks = Utils.freezeArray(incomingWebhooks); + this.incomingWebhooks = incomingWebhooks; this.receivedIncomingWebhooks = true; } + addIncomingWebhook(incomingWebhook) { + this.incomingWebhooks.push(incomingWebhook); + } + hasReceivedOutgoingWebhooks() { return this.receivedIncomingWebhooks; } @@ -57,10 +60,14 @@ class IntegrationStore extends EventEmitter { } setOutgoingWebhooks(outgoingWebhooks) { - this.outgoingWebhooks = Utils.freezeArray(outgoingWebhooks); + this.outgoingWebhooks = outgoingWebhooks; this.receivedOutgoingWebhooks = true; } + addOutgoingWebhook(outgoingWebhook) { + this.outgoingWebhooks.push(outgoingWebhook); + } + handleEventPayload(payload) { const action = payload.action; @@ -69,10 +76,18 @@ class IntegrationStore extends EventEmitter { this.setIncomingWebhooks(action.incomingWebhooks); this.emitChange(); break; + case ActionTypes.RECEIVED_INCOMING_WEBHOOK: + this.addIncomingWebhook(action.incomingWebhook); + this.emitChange(); + break; case ActionTypes.RECEIVED_OUTGOING_WEBHOOKS: this.setOutgoingWebhooks(action.outgoingWebhooks); this.emitChange(); break; + case ActionTypes.RECEIVED_OUTGOING_WEBHOOK: + this.addOutgoingWebhook(action.outgoingWebhook); + this.emitChange(); + break; } } } |