Skip to content
74592e7
@BerkeleyTrue @QuincyLarson @terakilobyte
30 lines (24 sloc) 713 Bytes
import { defaultProfileImage } from '../../common/utils/constantStrings.json';
const message =
'Learn to Code and Help Nonprofits';
module.exports = function(app) {
var router = app.loopback.Router();
router.get('/', addDefaultImage, index);
app.use(router);
function addDefaultImage(req, res, next) {
if (!req.user || req.user.picture) {
return next();
}
req.user.picture = defaultProfileImage;
return req.user.save(function(err) {
if (err) { return next(err); }
return next();
});
}
function index(req, res) {
if (req.user) {
return res.redirect('/challenges/current-challenge');
}
return res.render('home', { title: message });
}
};
Something went wrong with that request. Please try again.