Skip to content

Commit

Permalink
changing the way blood request details are sent
Browse files Browse the repository at this point in the history
  • Loading branch information
rhnmht30 committed Oct 1, 2019
1 parent b2ec85c commit 4246b61
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions controllers/admin_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ module.exports.donors = async (req, res) => {
module.exports.bloodRequests = async (req, res) => {
try {
let requests = await BloodRequest.find().sort({ createdAt: "desc" });
if (requests.length !== 0) {
res.status(200).json({ message: "success", requests });
} else {
res.status(404).json({ message: "No Requests!!" });
}

res.status(200).json({ message: "success", requests });
} catch (err) {
res.status(500).json({ message: err.message, error: true, data: null });
}
Expand Down

0 comments on commit 4246b61

Please sign in to comment.