Fix delete endpoint
This commit is contained in:
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user