Skip to content

Commit d8c9292

Browse files
committed
fix(products): fix updating product
1 parent cd0a5f1 commit d8c9292

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/routes/products.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ router.get('/:id', (req, res) => {
2828
});
2929

3030
router.put('/:id', (req, res) => {
31-
Product.update(req.body, {where: {id: req.params.id}}).then(([product]) => {
32-
res.json(product);
31+
Product.update(req.body, {where: {id: req.params.id}, returning: true, plain: true}).then(([, model]) => {
32+
res.json(model.dataValues);
3333
})
34-
3534
});
3635

3736
router.post('/', (req, res) => {
@@ -52,4 +51,4 @@ router.delete('/:id', (req, res) => {
5251

5352
});
5453

55-
module.exports = router;
54+
module.exports = router;

0 commit comments

Comments
 (0)