From ac28b3e19e25a7e2df69825c0cb07bf6eb46df4e Mon Sep 17 00:00:00 2001 From: Leon Liang Date: Thu, 24 Oct 2019 17:06:44 -0400 Subject: [PATCH] getUserDetails is now working --- functions/handlers/users.js | 4 ++-- functions/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/handlers/users.js b/functions/handlers/users.js index 09ffac0..09c3c79 100644 --- a/functions/handlers/users.js +++ b/functions/handlers/users.js @@ -178,11 +178,11 @@ exports.updateProfileInfo = (req, res) => { exports.getUserDetails = (req, res) => { let userData = {}; - db.doc(`/getUser/${req.params.handle}`) + db.doc(`/users/${req.body.handle}`) .get() .then((doc) => { if (doc.exists) { - userData.credentials = doc.data(); + userData = doc.data(); return res.status(200).json({userData}); } else { return res.status(400).json({ diff --git a/functions/index.js b/functions/index.js index 119fa38..a718b52 100644 --- a/functions/index.js +++ b/functions/index.js @@ -27,7 +27,7 @@ app.post("/signup", signup); // and password app.post("/login", login); -app.get("/getUser/:handle", fbAuth, getUserDetails); +app.get("/getUser", fbAuth, getUserDetails); // Returns all profile data of the currently logged in user app.get("/getProfileInfo", fbAuth, getProfileInfo);