UNPKG

@replyke/express

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

26 lines (25 loc) 935 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utility_functions_1 = require("./utility-functions"); exports.default = async (req, res, payload) => { const userCreatedWebhook = req.project.webhooks.userCreated; if (!userCreatedWebhook) return; const sharedSecret = req.project.keys.secret?.key; if (!sharedSecret) { return res .status(400) .json({ error: "Webhook URL or secret not configured" }); } try { const webhookResponse = await (0, utility_functions_1.sendWebhookRequestWithHandle)(userCreatedWebhook, payload, sharedSecret); if (!webhookResponse || webhookResponse.valid !== true) { return res.status(400).json({ error: webhookResponse?.message || "Invalid user data", }); } } catch (err) { res.status(500).json({ error: err.message }); } };