fixing image display for posts on profile page, adding success confirmation modal, changing posts display,
This commit is contained in:
@@ -36,13 +36,17 @@ export const getPost = async (req, res, next) => {
|
||||
}
|
||||
|
||||
export const getAllPostsByUser = async (req, res, next) => {
|
||||
const post = await Post.find({ email: req.params.user }).exec()
|
||||
if (!post) {
|
||||
console.log(req.params)
|
||||
const posts = await Post.find({ userID: req.params.user }).exec()
|
||||
posts.map((el) => {
|
||||
el.photo = process.env.CLOUDFRONT_URL + el.photo
|
||||
})
|
||||
if (!posts) {
|
||||
return next('No document found with that id', 404)
|
||||
}
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: post
|
||||
data: posts
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user