Go back to map when no more hikes are found

This commit is contained in:
Berkeley Martinez
2015-07-19 10:39:50 -07:00
parent 47901a9b0a
commit f735572b6e

View File

@ -45,9 +45,8 @@ export default stampit(React, {
`/hikes/${ dashedName }/questions/${ nextQuestionIndex + 1 }`
);
}
// next questions does not exit
// find next hike
//
// next questions does not exist;
debug('finding next hike');
const nextHike = [].slice.call(hikes)
// hikes is in oder of difficulty, lets get reverse order
.reverse()
@ -62,7 +61,8 @@ export default stampit(React, {
if (nextHike) {
return this.transitionTo(`/hikes/${ nextHike.dashedName }`);
}
debug('next Hike was not found');
debug('next Hike was not found, currentHike %s', currentHike.dashedName);
this.transitionTo('/hikes');
});
},