Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //...
- router.get('/:username', auth.optional, function(req, res, next) {
- // if the profile is being navigated to by a logged in user,
- if (req.payload) {
- User.findById(req.payload.id).then(function(user) {
- if (!user) { return res.json({profile: req.profile.toProfileJSONFor(false)}); }
- return res.json({profile: req.profile.toProfileJSONFor(user)});
- });
- } else {
- return res.json({profile: req.profile.toProfileJSONFor(false)});
- }
- });
- //...
Add Comment
Please, Sign In to add comment