Commit 3c395ae3 authored by zarina's avatar zarina 🌊

рефактор кода

parent d2e82b69
......@@ -44,7 +44,7 @@ const createRouter = () => {
if (req.file) {
productData.image = req.file.filename;
} else {
productData.image = 'ic-dialog.png';
productData.image = 'somePhoto.jpeg';
}
const product = new Product(productData);
......@@ -55,7 +55,6 @@ const createRouter = () => {
}
});
router.delete("/:id", auth, async (req, res) => {
const product = await Product.findById(req.params.id);
if (req.user._id.toString() === product.author.toString()) {
......@@ -66,7 +65,6 @@ const createRouter = () => {
}
});
return router;
};
......
......@@ -49,9 +49,7 @@ const createRouter = () => {
user.generateToken();
await user.save();
res.send(success);
});
return router;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment