Merge pull request #3602 from FreeCodeCamp/fix/share-able-url-solution-undefined

fix shareable challenges solution undefined
pull/3571/merge
Quincy Larson 2015-10-05 22:09:03 -07:00
commit 9bce039e7a
1 changed files with 7 additions and 6 deletions

View File

@ -267,12 +267,13 @@ module.exports = function(app) {
}
if (dasherize(challenge.name) !== origChallengeName) {
return Observable.just(
'/challenges/' +
dasherize(challenge.name) +
'?solution=' +
encodeURIComponent(solutionCode)
);
let redirectUrl = `/challenges/${dasherize(challenge.name)}`;
if (solutionCode) {
redirectUrl += `?solution=${encodeURIComponent(solutionCode)}`;
}
return Observable.just(redirectUrl);
}
// save user does nothing if user does not exist