update to react-router 1.0.0-rc1
This commit is contained in:
@@ -4,7 +4,7 @@ import React from 'react';
|
||||
import Fetchr from 'fetchr';
|
||||
import debugFactory from 'debug';
|
||||
import { Router } from 'react-router';
|
||||
import { history } from 'react-router/lib/BrowserHistory';
|
||||
import { createLocation, createHistory } from 'history';
|
||||
import { hydrate } from 'thundercats';
|
||||
import { Render } from 'thundercats-react';
|
||||
|
||||
@@ -18,21 +18,28 @@ const services = new Fetchr({
|
||||
});
|
||||
|
||||
Rx.config.longStackSupport = !!debug.enabled;
|
||||
|
||||
const history = createHistory();
|
||||
const appLocation = createLocation(
|
||||
location.pathname + location.search
|
||||
);
|
||||
// returns an observable
|
||||
app$(history)
|
||||
app$({ history, location: appLocation })
|
||||
.flatMap(
|
||||
({ AppCat }) => {
|
||||
// instantiate the cat with service
|
||||
const appCat = AppCat(null, services);
|
||||
// hydrate the stores
|
||||
return hydrate(appCat, catState)
|
||||
.map(() => appCat);
|
||||
},
|
||||
({ initialState }, appCat) => ({ initialState, appCat })
|
||||
// not using nextLocation at the moment but will be used for
|
||||
// redirects in the future
|
||||
({ nextLocation, props }, appCat) => ({ nextLocation, props, appCat })
|
||||
)
|
||||
.flatMap(({ initialState, appCat }) => {
|
||||
.flatMap(({ props, appCat }) => {
|
||||
return Render(
|
||||
appCat,
|
||||
React.createElement(Router, initialState),
|
||||
React.createElement(Router, props),
|
||||
DOMContianer
|
||||
);
|
||||
})
|
||||
|
Reference in New Issue
Block a user