Files
freeCodeCamp/common/app/routes/index.js
Berkeley Martinez 95aab958aa Feature(langauge): Make client history language aware
Remove need for language aware links
2016-07-28 23:40:01 -07:00

24 lines
515 B
JavaScript

import { modernChallenges, map, challenges } from './challenges';
import NotFound from '../components/NotFound/index.jsx';
import { addLang } from '../utils/lang';
export default {
path: '/:lang',
indexRoute: {
onEnter(nextState, replace) {
const { lang } = nextState.params;
const { pathname } = nextState.location;
replace(addLang(pathname, lang));
}
},
childRoutes: [
challenges,
modernChallenges,
map,
{
path: '*',
component: NotFound
}
]
};