Invite bug fix

This commit is contained in:
Lukas Nowy
2019-02-18 00:54:34 +01:00
parent 5dfadaef2f
commit 6550aa5e51
4 changed files with 80 additions and 6 deletions

View File

@ -148,6 +148,30 @@ router.get("/sharedshoppinglists", async function(req, res, next) {
});
});
//GET ALL SHOPPINGLISTS
router.get("/shoppinglistsbylink", async function(req, res, next) {
var token = req.query.idtoken;
firebaseAdmin.auth().verifyIdToken(token)
.then(async function(decodedToken) {
uid = decodedToken.uid;
console.log("uid", uid)
try {
//Get user id: req.session.passport.user.profile.id
res.status(200).send(await postgres.getShoppinglistsByLink(req.query.link));
}
catch(err) {
res.status(400).send(await err);
}
}).catch(function(error) {
console.log(error)
});
});
//POST new shoppinglist
@ -197,6 +221,8 @@ router.get("/shoppinglist_json/:sl_id", async (req, res) => {
});
postgres.displayShoppinglist("4tezJYMK");
//DELETE Shoppinglist