From 0e5b6faaa51ade7ce4070017ae4e7133d7b58d78 Mon Sep 17 00:00:00 2001 From: Mikael <46541386+ahnl@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:18:56 +0300 Subject: [PATCH] feat(apply): invoke webhook --- src/routes/apply.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/routes/apply.js b/src/routes/apply.js index c2e6a98..469bffe 100644 --- a/src/routes/apply.js +++ b/src/routes/apply.js @@ -104,9 +104,20 @@ router.post("/submit", async (req, res) => { status: "RECEIVED" } }, { upsert: true, new: true }) + console.log(doc); - console.log(doc) + // give http response res.json({status: "ok"}) + + // invoke webhook + const webhookData = { + firstName, + lastName, + city, + email, + username, + } + await axios.post(process.env.APPLY_WEBHOOK, webhookData) } catch (e) { console.log(e) res.status(500).json({status: "error"})