Fixed having multiple return statements in post.js

This commit is contained in:
Clayton Wilson 2019-12-02 15:47:26 -05:00
parent cff0fd4e05
commit 7c7256acbd

View File

@ -40,12 +40,11 @@ exports.getallPostsforUser = (req, res) => {
});
return res.status(200).json(posts);
})
.then(function() {
return res.status(200).json("Successfully retrieved all user's posts from database.");
})
// .then(function() {
// return res.status(200).json("Successfully retrieved all user's posts from database.");
// })
.catch(function(err) {
return res.status(500).json("Failed to retrieve user's posts from database.", err);
return res.status(500).json(`Failed to retrieve user's posts from database.\n${err}`);
});
};
@ -59,11 +58,11 @@ exports.getallPosts = (req, res) => {
});
return res.status(200).json(posts);
})
.then(function() {
return res.status(200).json("Successfully retrieved every post from database.");
})
// .then(function() {
// return res.status(200).json("Successfully retrieved every post from database.");
// })
.catch(function(err) {
return res.status(500).json("Failed to retrieve posts from database.", err);
return res.status(500).json(`Failed to retrieve posts from database.\n ${err}`);
});
};