Redirect /challenges to /map
This commit is contained in:
@ -1,6 +1,12 @@
|
|||||||
import Challenges from './components/Challenges.jsx';
|
import Challenges from './components/Challenges.jsx';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
path: 'challenges',
|
path: 'challenges(/:dashedName)',
|
||||||
component: Challenges
|
component: Challenges,
|
||||||
|
onEnter(nextState, replace) {
|
||||||
|
// redirect /challenges to /map
|
||||||
|
if (nextState.location.pathname === '/challenges') {
|
||||||
|
replace('/map');
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,6 +15,7 @@ const routes = [
|
|||||||
'/videos',
|
'/videos',
|
||||||
'/videos/*',
|
'/videos/*',
|
||||||
'/challenges',
|
'/challenges',
|
||||||
|
'/challenges/*',
|
||||||
'/map'
|
'/map'
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -45,7 +46,8 @@ export default function reactSubRouter(app) {
|
|||||||
// if react-router does not find a route send down the chain
|
// if react-router does not find a route send down the chain
|
||||||
.filter(({ redirect, props }) => {
|
.filter(({ redirect, props }) => {
|
||||||
if (!props && redirect) {
|
if (!props && redirect) {
|
||||||
res.redirect(redirect.pathname + redirect.search);
|
log('react router found a redirect');
|
||||||
|
return res.redirect(redirect.pathname + redirect.search);
|
||||||
}
|
}
|
||||||
if (!props) {
|
if (!props) {
|
||||||
log(`react tried to find ${req.path} but got 404`);
|
log(`react tried to find ${req.path} but got 404`);
|
||||||
|
Reference in New Issue
Block a user