Product Delete Issue

0
Posted at December 10, 2020 57 Views . 0 Saved .

After clicked delete button, automatically route to signin page

2 Comments
Nabil ALLAM
The same Problem ! when i try to get req the body is empty i'dont know whey ! how can i put the product checked in the payload ? exports.deleteProductById = (req, res) => { console.log({ body: req }); const { productId } = req.body.payload; console.log({ productId }); if (productId) { Product.deleteOne({ _id: productId }).exec((error, result) => { if (error) return res.status(400).json({ error }); if (result) { res.status(202).json({ result }); } }); } else { res.status(400).json({ error: "Params required" }); } };
Rizwan Khan
Please pull the latest code to make it work