Update history/react-router

This commit is contained in:
Berkeley Martinez
2016-03-03 17:53:33 -08:00
parent a2a988764c
commit c50510db71
7 changed files with 18 additions and 20 deletions
+7 -8
View File
@@ -1,6 +1,5 @@
import React from 'react';
import { RoutingContext } from 'react-router';
import { createLocation } from 'history';
import { RouterContext } from 'react-router';
import debug from 'debug';
import renderToString from '../../common/app/utils/render-to-string';
@@ -39,15 +38,15 @@ export default function reactSubRouter(app) {
function serveReactApp(req, res, next) {
const serviceOptions = { req };
const location = createLocation(req.path);
// returns a router wrapped app
app$({
location,
location: req.path,
serviceOptions
})
// if react-router does not find a route send down the chain
.filter(({ props }) => {
.filter(({ redirect, props }) => {
if (!props && redirect) {
res.redirect(redirect.pathname + redirect.search);
}
if (!props) {
log(`react tried to find ${location.pathname} but got 404`);
return next();
@@ -58,7 +57,7 @@ export default function reactSubRouter(app) {
log('render react markup and pre-fetch data');
return renderToString(
provideStore(React.createElement(RoutingContext, props), store)
provideStore(React.createElement(RouterContext, props), store)
)
.map(({ markup }) => ({ markup, store }));
})
-1
View File
@@ -28,7 +28,6 @@ export default function getJobServices(app) {
},
read(req, resource, params, config, cb) {
const id = params ? params.id : null;
console.log('params', params);
if (id) {
return Job.findById(id)
.then(job => cb(null, job.toJSON()))