This commit is contained in:
Ruslan Zagitov 2025-02-05 18:55:22 +03:00
parent 33845b743d
commit 7cdbec53ee

View File

@ -91,14 +91,7 @@ router.get('/:id', (req, res) => {
return res.status(404).send('Unit not found');
}
const user = users.find((user) => {
if (user.public_id == unit.author) {
return user;
}
});
if (!user) {
return res.status(404).send('User not found');
}
const user = users.find((user) => user.public_id == unit.author);
res.send({...unit, author: user});
});