diff --git a/common/app/routes/Hikes/components/Hikes.jsx b/common/app/routes/Hikes/components/Hikes.jsx index f48fbc8d96..2b248eb320 100644 --- a/common/app/routes/Hikes/components/Hikes.jsx +++ b/common/app/routes/Hikes/components/Hikes.jsx @@ -9,7 +9,7 @@ export default React.createClass({ render() { const { id - } = this.props; + } = this.props.params; return (

Hello { id }

diff --git a/common/app/routes/Hikes/index.js b/common/app/routes/Hikes/index.js index daeb64174d..02b140cf4a 100644 --- a/common/app/routes/Hikes/index.js +++ b/common/app/routes/Hikes/index.js @@ -1,7 +1,7 @@ import Hikes from './components/Hikes.jsx'; export default { - path: 'hikes', + path: 'hikes(/:id)', getComponents(cb) { setTimeout(() => { diff --git a/common/app/routes/index.js b/common/app/routes/index.js index a87d5a1423..a8e3e6a014 100644 --- a/common/app/routes/index.js +++ b/common/app/routes/index.js @@ -1,4 +1,4 @@ -import Jobs from './Jobs'; +// import Jobs from './Jobs'; import Hikes from './Hikes'; export default { @@ -6,8 +6,7 @@ export default { getChildRoutes(locationState, cb) { setTimeout(() => { cb(null, [ - // require('./Bonfires'), - Jobs, + // Jobs, Hikes ]); }, 0); diff --git a/server/boot/a-react.js b/server/boot/a-react.js index f4315e7f5d..0c45ca4378 100644 --- a/server/boot/a-react.js +++ b/server/boot/a-react.js @@ -10,7 +10,9 @@ const debug = debugFactory('freecc:servereact'); // add routes here as they slowly get reactified // remove their individual controllers const routes = [ - '/Hikes' + '/Hikes', + '/Hikes/:id', + '/jobs' ]; export default function reactSubRouter(app) { @@ -29,29 +31,21 @@ export default function reactSubRouter(app) { // returns a router wrapped app app$(location) // if react-router does not find a route send down the chain - .filter(function(initialState) { - console.log('initialState', initialState); - /* - var state = data.state; - // this may not work with react-router 1.0.0 - var notFound = state.routes.some(route => route.isNotFound); - if (notFound) { - debug('tried to find %s but got 404', state.path); - next(); + .filter(function([ initialState ]) { + if (!initialState) { + debug('tried to find %s but got 404', location.pathname); + return next(); } - return !notFound; - */ - return true; + return !!initialState; }) - .flatMap(function(initialState) { + .flatMap(function([ initialState ]) { // call thundercats renderToString // prefetches data and sets up it up for current state return fcc.renderToString( - React.createElement(Router, initialState[0]) + React.createElement(Router, initialState) ); }) // makes sure we only get one onNext and closes subscription - .firstOrDefault() .flatMap(function({ data, markup }) { debug('react rendered'); res.expose(data, 'data');