Commit 3c395ae3 authored by zarina's avatar zarina 🌊

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

parent d2e82b69
...@@ -44,7 +44,7 @@ const createRouter = () => { ...@@ -44,7 +44,7 @@ const createRouter = () => {
if (req.file) { if (req.file) {
productData.image = req.file.filename; productData.image = req.file.filename;
} else { } else {
productData.image = 'ic-dialog.png'; productData.image = 'somePhoto.jpeg';
} }
const product = new Product(productData); const product = new Product(productData);
...@@ -55,7 +55,6 @@ const createRouter = () => { ...@@ -55,7 +55,6 @@ const createRouter = () => {
} }
}); });
router.delete("/:id", auth, async (req, res) => { router.delete("/:id", auth, async (req, res) => {
const product = await Product.findById(req.params.id); const product = await Product.findById(req.params.id);
if (req.user._id.toString() === product.author.toString()) { if (req.user._id.toString() === product.author.toString()) {
...@@ -66,7 +65,6 @@ const createRouter = () => { ...@@ -66,7 +65,6 @@ const createRouter = () => {
} }
}); });
return router; return router;
}; };
......
...@@ -49,9 +49,7 @@ const createRouter = () => { ...@@ -49,9 +49,7 @@ const createRouter = () => {
user.generateToken(); user.generateToken();
await user.save(); await user.save();
res.send(success); res.send(success);
}); });
return router; 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