use the correct id param for destroy and update
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import httpStatus from 'http-status';
|
||||
|
||||
const destroy = (req, res) => {
|
||||
req.model.findOneAndDelete({ _id: req.params._id }, (err, doc) => {
|
||||
req.model.findOneAndDelete({ _id: req.params.id }, (err, doc) => {
|
||||
if (err)
|
||||
return res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ error: err });
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import httpStatus from 'http-status';
|
||||
|
||||
const update = (req, res) => {
|
||||
req.model.setDefaultLocale(req.locale); // TODO - move to middleware
|
||||
req.model.findOne({ _id: req.params._id }, '', {}, (err, doc) => {
|
||||
req.model.findOne({ _id: req.params.id }, '', {}, (err, doc) => {
|
||||
if (!doc)
|
||||
return res.status(httpStatus.NOT_FOUND).send('Not Found');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user