FIX: webhook is already resolved

This commit is contained in:
BradBot_1 2023-02-23 01:45:41 +00:00
parent 06fe17115b
commit cc31287692

View file

@ -13,14 +13,14 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
export type WebhookRecievedCallback = (webhookId: string, webhook: Promise<any>) => void; export type WebhookRecievedCallback = (webhookId: string, webhook: any) => void;
export function setupWebhookRoutes(router:any, webhookRecievedCallback:WebhookRecievedCallback):void { export function setupWebhookRoutes(router:any, webhookRecievedCallback:WebhookRecievedCallback):void {
router.post('/webhook/:webhook', (req: any, res: any) => { router.post('/webhook/:webhook', (req: any, res: any) => {
const webhookId = req.params.webhook; const webhookId = req.params.webhook;
console.log("[WEB] Recieved webhook " + webhookId); console.log("[WEB] Recieved webhook " + webhookId);
webhookRecievedCallback(webhookId, res.body); webhookRecievedCallback(webhookId, req.body);
res.statusCode = 200; res.statusCode = 200;
res.end(); res.end();
}); });