Front page project powered by MERN stack.
28/09/2018 ID:4
04/06/2018 ID:3
29/05/2018 ID:2
24/05/2018 ID: 1
ID:3
Before:
User.findOne({id: jwt_payload._id}
After:
User.findOne({id: jwt_payload.id}
ID:2
Before:
router.put('/links/:id', function(req, res, next) {
Link.findOneAndUpdate(req.params.id, req.body, function(err, link) {
if (err) return next(err);
res.json(link);
});
});
After:
router.put('/links/:id', function(req, res, next) {
Link.findByIdAndUpdate(req.params.id, req.body, function(err, link) {
if (err) return next(err);
res.json(link);
});
});
ID:1
Before:
<Route path='/show/:id' component={Show} />
<Route path='/edit/:id' component={Edit} />
After:
<Route path='/show/:_id' component={Show} />
<Route path='/edit/:_id' component={Edit} />