fix: decouple rendering from pages
This commit is contained in:
9
server/boot/react.js
vendored
9
server/boot/react.js
vendored
@ -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');
|
||||
|
Reference in New Issue
Block a user