diff --git a/routes/api/stream/index.js b/routes/api/stream/index.js index ba35b4138..1bbe259e4 100644 --- a/routes/api/stream/index.js +++ b/routes/api/stream/index.js @@ -8,12 +8,12 @@ const router = express.Router(); router.get('/', (req, res, next) => { - const comments = Comment.findByAssetId(req.query.asset_id) || []; + const comments = Comment.findByAssetId(req.query.asset_id); const users = User.findByIdArray(comments.map((comment) => comment.author_id)); const actions = Action.findByItemIdArray(comments.map((comment) => comment.id)); Promise.all([comments, users, actions]).then(([comments, users, actions]) => { - res.json(...comments,...users,...actions); + res.json([...comments,...users,...actions]); }).catch(error => { next(error); });