Files
freeCodeCamp/common/app/routes/index.js

32 lines
717 B
JavaScript
Raw Normal View History

import {
modernChallengesRoute,
mapRoute,
challengesRoute
} from './challenges';
2015-11-19 22:45:31 -08:00
import NotFound from '../components/NotFound/index.jsx';
import { addLang } from '../utils/lang';
import settingsRoute from './settings';
export default function createChildRoute(deps) {
return {
path: '/:lang',
indexRoute: {
onEnter(nextState, replace) {
const { lang } = nextState.params;
const { pathname } = nextState.location;
replace(addLang(pathname, lang));
}
},
childRoutes: [
challengesRoute(deps),
modernChallengesRoute(deps),
mapRoute(deps),
settingsRoute(deps),
{
path: '*',
component: NotFound
}
]
};
}