fix cannot find challengeId of undefined

This commit is contained in:
Berkeley Martinez
2015-08-18 20:02:39 -07:00
parent 0128829d11
commit 01a45e0635

View File

@ -137,7 +137,9 @@ module.exports = function(app) {
// unless the next block is undefined, which means no next block
let nextChallengeName = firstChallenge;
const challengeId = req.user.currentChallenge.challengeId;
const challengeId = req.user.currentChallenge ?
req.user.currentChallenge.challengeId :
'bd7123c8c441eddfaeb5bdef';
// find challenge
return challenge$
.map(challenge => challenge.toJSON())