From effd629bc5ed93ce90bde7aea3ba69ae1e9f090f Mon Sep 17 00:00:00 2001 From: Lucas Silva Date: Wed, 10 May 2017 14:08:24 -0300 Subject: [PATCH] Refactored chat socket and hero routes responses --- app/chat/chat_socket.js | 4 ---- app/routes/hero_routes.js | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/chat/chat_socket.js b/app/chat/chat_socket.js index 4b57fa7..739252a 100644 --- a/app/chat/chat_socket.js +++ b/app/chat/chat_socket.js @@ -27,9 +27,6 @@ module.exports = function(server) { })); io.on('connection', function(socket) { - ChatRecord.remove({}, function() { - - }) let user = socket.request.user; socket.on('subscribe', function(heroId) { @@ -58,7 +55,6 @@ module.exports = function(server) { socket.on('retrieve messages', function(heroId, fn) { ChatRecord.find({heroId: heroId}, function(err, records){ fn(records); - console.log(records); }); }); diff --git a/app/routes/hero_routes.js b/app/routes/hero_routes.js index 2717333..b395e3c 100644 --- a/app/routes/hero_routes.js +++ b/app/routes/hero_routes.js @@ -54,7 +54,7 @@ module.exports = function (app) { User.findOne({ email: req.user.email }, function (err, doc) { if (err) throw err; - return res.status(200).json({ success: true, message: 'Successfully unmarked hero as favorite', favorites: doc.favorites }); + return res.status(200).json({ success: true, favorites: doc.favorites }); }); }); @@ -64,7 +64,7 @@ module.exports = function (app) { if (err) { throw err; } else { - return res.status(200).json({ success: true, message: 'Successfully', result: heroes }); + return res.status(200).json({ success: true, result: heroes }); } }) }); @@ -75,8 +75,7 @@ module.exports = function (app) { if (err) { throw err; } else { - console.log(hero); - return res.status(200).json({ success: true, message: 'Successfully', hero: hero }); + return res.status(200).json({ success: true, hero: hero }); } }); });