diff --git a/controllers/itemController.js b/controllers/itemController.js index 8c6e664..ee2cb2e 100644 --- a/controllers/itemController.js +++ b/controllers/itemController.js @@ -36,7 +36,7 @@ exports.edit_get_api = asyncHandler(async(req,res,next)=>{ const collections = await collectionModel.find({}) if(req.params.id){ let item = await itemModel.findById({_id: req.params.id}); - res.send({title:'item',item:item,collections:collections,}) + return res.send({title:'item',item:item,collections:collections}) } res.send({title:'item',collections:collections,}) @@ -179,7 +179,7 @@ exports.edit_post_api = [ } else{ - if (!req.body.id) { + if (!req.params.id) { // setting collection let categoryId=await collectionModel.find({name:req.body.category},{_id:1}) categoryId=categoryId[0]['_id'] @@ -195,8 +195,7 @@ exports.edit_post_api = [ category:categoryId, src:src}); await item.save() - - res.send({url:item.url}) + return res.send({url:item.url}) } const itemExists = await itemModel.find({name: req.body.name}).exec() @@ -218,7 +217,7 @@ exports.edit_post_api = [ src:src}, { new: true } // This option returns the modified document ).exec(); - res.send({url:item.url}) + return res.send({url:item.url}) } } diff --git a/uploads/2014-09-04_Addis_Look_11_35.webp b/uploads/2014-09-04_Addis_Look_11_35.webp new file mode 100644 index 0000000..d555bda Binary files /dev/null and b/uploads/2014-09-04_Addis_Look_11_35.webp differ diff --git a/uploads/h7jduwfvblnmj0ktavuz.jpg b/uploads/h7jduwfvblnmj0ktavuz.jpg new file mode 100644 index 0000000..c3d1949 Binary files /dev/null and b/uploads/h7jduwfvblnmj0ktavuz.jpg differ