diff --git a/index.js b/index.js index aa92988..ba0438c 100644 --- a/index.js +++ b/index.js @@ -110,6 +110,15 @@ DB.getDB.then((DB) => { DB.setWebSubscription(profileid, subscription); }); + app.get("/invite/:email", async (req, res) => { + const email = req.params.email; + //validate email? + if(!email) return res.json({status: "provide valid email"}); + let r = await DB.getInvitation(email); + if(!r) return res.json({status: "no invitation found with that email"}); + return res.json({status: "ok", ... r}); + }); + // Function to Singup new users. An user is a combination of a user obj and a profile. // When new users are subscribed, they have a single profile, which is the personal one. // Other profiles can be link to that user, like groups or courses. diff --git a/routes/profile.js b/routes/profile.js index 89f1357..1e5478b 100644 --- a/routes/profile.js +++ b/routes/profile.js @@ -79,9 +79,9 @@ DB.getDB.then((DB)=>{ router.get("/invite/:email", async (req, res) => { const userid = getUserId(req); - const email = req.body.email; + const email = req.params.email; //validate email? - if(email) return res.json({status: "provide valid email"}); + if(!email) return res.json({status: "provide valid email"}); let r = await DB.getInvitation(email); if(!r) return res.json({status: "no invitation found with that email"}); return res.json({status: "ok", ... r});