Speech as a package #416
4 changed files with 4214 additions and 5 deletions
4200
index.js
4200
index.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -7,11 +7,16 @@ import { Reducers, GAListener, App } from 'spee.ch-components';
|
||||||
import renderFullPage from './renderFullPage.js';
|
import renderFullPage from './renderFullPage.js';
|
||||||
import Helmet from 'react-helmet';
|
import Helmet from 'react-helmet';
|
||||||
|
|
||||||
|
const siteConfig = require('siteConfig.js');
|
||||||
|
|
||||||
module.exports = (req, res) => {
|
module.exports = (req, res) => {
|
||||||
let context = {};
|
let context = {};
|
||||||
|
|
||||||
|
// customize the reducer by passing in intial state configs
|
||||||
|
const customizedReducers = Reducers(siteConfig);
|
||||||
|
|
||||||
// create a new Redux store instance
|
// create a new Redux store instance
|
||||||
const store = createStore(Reducers);
|
const store = createStore(customizedReducers);
|
||||||
|
|
||||||
// render component to a string
|
// render component to a string
|
||||||
const html = renderToString(
|
const html = renderToString(
|
||||||
|
@ -40,4 +45,6 @@ module.exports = (req, res) => {
|
||||||
|
|
||||||
// send the rendered page back to the client
|
// send the rendered page back to the client
|
||||||
res.send(renderFullPage(helmet, html, preloadedState));
|
res.send(renderFullPage(helmet, html, preloadedState));
|
||||||
|
|
||||||
|
console.log('hello from spee.ch handlePageRender.jsx');
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,6 +10,10 @@ import { Reducers, GAListener, App, Sagas, Actions } from 'spee.ch-components';
|
||||||
|
|
||||||
import Helmet from 'react-helmet';
|
import Helmet from 'react-helmet';
|
||||||
|
|
||||||
|
// configure the reducers by passing initial state configs
|
||||||
|
const siteConfig = require('siteConfig.js');
|
||||||
|
const customizedReducers = Reducers(siteConfig);
|
||||||
|
|
||||||
const returnSagaWithParams = (saga, params) => {
|
const returnSagaWithParams = (saga, params) => {
|
||||||
return function * () {
|
return function * () {
|
||||||
yield call(saga, params);
|
yield call(saga, params);
|
||||||
|
@ -24,7 +28,7 @@ module.exports = (req, res) => {
|
||||||
const middleware = applyMiddleware(sagaMiddleware);
|
const middleware = applyMiddleware(sagaMiddleware);
|
||||||
|
|
||||||
// create a new Redux store instance
|
// create a new Redux store instance
|
||||||
const store = createStore(Reducers, middleware);
|
const store = createStore(customizedReducers, middleware);
|
||||||
|
|
||||||
// create saga
|
// create saga
|
||||||
const action = Actions.onHandleShowPageUri(req.params);
|
const action = Actions.onHandleShowPageUri(req.params);
|
||||||
|
@ -60,4 +64,6 @@ module.exports = (req, res) => {
|
||||||
// send the rendered page back to the client
|
// send the rendered page back to the client
|
||||||
res.send(renderFullPage(helmet, html, preloadedState));
|
res.send(renderFullPage(helmet, html, preloadedState));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('hello from spee.ch handleShowRender.jsx');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue