fix shareable challenges solution undefined
During challenges when a user tries to navigate to a challenge and hits the name redirect, the solution is filled with undefined starting the user with an empty box. This PR fixes the issue by ignoring the solution param if it is empty
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user