Skip to content

Commit

Permalink
Refactored chat socket and hero routes responses
Browse files Browse the repository at this point in the history
  • Loading branch information
lucashsilva committed May 10, 2017
1 parent f9e06c4 commit effd629
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 0 additions & 4 deletions app/chat/chat_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
});
});

Expand Down
7 changes: 3 additions & 4 deletions app/routes/hero_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
});

Expand All @@ -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 });
}
})
});
Expand All @@ -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 });
}
});
});
Expand Down

0 comments on commit effd629

Please sign in to comment.