Skip to content

Commit

Permalink
Fixed permission issue
Browse files Browse the repository at this point in the history
cleaned webhook
  • Loading branch information
bsears90 committed Mar 30, 2018
1 parent b4ac1da commit 13b1360
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion middleware/auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let Role = require("../models/role.js");
let _ = require("lodash");
let swaggerJSON = require("../api-docs/api-paths.json");
let swaggerJSON = {...require("../api-docs/api-entity-paths.json"), ...require("../api-docs/api-paths.json")};


//todo: allow for multiple permissions
Expand Down
7 changes: 5 additions & 2 deletions plugins/webhooks/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ function* run(config, provide, channels) {
let webhooks = await db("webhooks").where(true, true);
let webhook_responses = await Promise.reduce(webhooks, async (responses, webhook) => {

let parsedEvent = Object.values(event).map(eventValue => entry)
let webhookRequest = fetch(webhook.endpoint_url, {method: "POST", body: JSON.stringify({event_name : eventName, event_data : event}), headers})
let parsedEvent = Object.entries(event).reduce((acc, [key, eventValue]) => {
acc[key] = eventValue.data ? eventValue.data : eventValue;
return acc;
}, {});
let webhookRequest = fetch(webhook.endpoint_url, {method: "POST", body: JSON.stringify({event_name : eventName, event_data : parsedEvent}), headers})
.then(response => {
if (!response.ok) {
console.error("error making webhook request", response.statusText);
Expand Down

0 comments on commit 13b1360

Please sign in to comment.