fix: decouple rendering from pages

This commit is contained in:
Berkeley Martinez
2016-12-16 08:10:08 -08:00
parent 0e984fe142
commit c1ad8f0b55

View File

@ -3,9 +3,8 @@ import { RouterContext } from 'react-router';
import debug from 'debug';
import { renderToString } from 'redux-epic';
import provideStore from '../../common/app/provide-store';
import createApp from '../../common/app';
import blockNameify from '../../common/app/utils/blockNameify';
import provideStore from '../../common/app/provide-store';
const log = debug('fcc:react-server');
@ -85,11 +84,7 @@ export default function reactSubRouter(app) {
.flatMap(function({ markup, store, epic }) {
log('react markup rendered, data fetched');
const state = store.getState();
const { challenge } = state.entities;
const challengeKey = Object.keys(challenge)[0];
const blockName = blockNameify(challenge[challengeKey].block);
const challengeTitle = challenge[challengeKey].title;
const title = `${blockName}: ${challengeTitle}`;
const { title } = state.app;
epic.dispose();
res.expose(state, 'data');
res.expose(req.flash(), 'flash');