2018-04-06 14:51:52 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { renderToString } from 'react-dom/server';
|
2018-03-26 13:01:24 +01:00
|
|
|
|
2018-04-06 14:51:52 +01:00
|
|
|
import { createStore } from './src/redux/store';
|
|
|
|
|
|
|
|
exports.replaceRenderer = ({
|
|
|
|
history,
|
|
|
|
bodyComponent,
|
|
|
|
replaceBodyHTMLString
|
|
|
|
}) => {
|
|
|
|
const store = createStore(history);
|
|
|
|
|
|
|
|
const ConnectedBody = () => (
|
|
|
|
<Provider store={store}>{bodyComponent}</Provider>
|
|
|
|
);
|
|
|
|
replaceBodyHTMLString(renderToString(<ConnectedBody />));
|
|
|
|
};
|
2018-04-09 00:11:35 +01:00
|
|
|
|
|
|
|
exports.onRenderBody = ({ setPostBodyComponents }) =>
|
|
|
|
setPostBodyComponents([
|
|
|
|
<script
|
|
|
|
async='true'
|
|
|
|
key='chai-CDN'
|
|
|
|
src='https://cdnjs.cloudflare.com/ajax/libs/chai/4.1.2/chai.min.js'
|
|
|
|
/>
|
|
|
|
]);
|