Skip to content

Commit

Permalink
fix: handle data.crud object
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Nov 29, 2023
1 parent 00996f5 commit 15ffb7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CoCreateLazyLoader {
if (valideUrl.pathname.startsWith('/webhooks/')) {
let name = req.url.split('/')[2]; // Assuming URL structure is /webhook/name/...
if (this.modules[name]) {
this.executeScriptWithTimeout(name, { req, res, crud: this.crud, organization, valideUrl, organization_id: organization._id })
this.executeScriptWithTimeout(name, { req, res, organization, valideUrl, organization_id: organization._id })
} else {
// Handle unknown module or missing webhook method
res.writeHead(404, { 'Content-Type': 'application/json' });
Expand Down Expand Up @@ -118,8 +118,10 @@ class CoCreateLazyLoader {

if (this.modules[name].content) {
data.apis = await this.getApiKey(data.organization_id, name)
data.crud = this.crud
data = await this.modules[name].content.send(data)
delete data.apis
delete data.crud
if (data.socket)
this.wsManager.send(data)
} else
Expand Down

0 comments on commit 15ffb7c

Please sign in to comment.