Fix delete endpoint

This commit is contained in:
aeroreyna
2022-02-21 22:37:38 -08:00
parent 3610482aec
commit 5998bbb484

View File

@@ -13,7 +13,7 @@ DB.getDB.then((DB) => {
const postBelongToProfile = (post, profileid) => { const postBelongToProfile = (post, profileid) => {
if(!post) return false; if(!post) return false;
return post.profileid === profileid; return post.profileid == profileid;
}; };
const generateNonOrganicPosts = async (req, profileid) => { const generateNonOrganicPosts = async (req, profileid) => {
@@ -204,7 +204,7 @@ DB.getDB.then((DB) => {
}); });
router.delete("/:id", async (req, res) => { router.delete("/:id", async (req, res) => {
const profileid = getProfileId(req); const profileid = getProfileId(req) + '';
const postId = req.params.id; const postId = req.params.id;
const post = await DB.getPost(postId); const post = await DB.getPost(postId);
if(!postBelongToProfile(post, profileid)) if(!postBelongToProfile(post, profileid))