| 
									
										
										
										
											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-18 11:15:32 +01:00
										 |  |  | import headComponents from './src/head'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-18 11:15:32 +01:00
										 |  |  | exports.onRenderBody = ({ setHeadComponents, setPostBodyComponents }) => { | 
					
						
							|  |  |  |   setHeadComponents([...headComponents]); | 
					
						
							| 
									
										
										
										
											2018-04-09 00:11:35 +01:00
										 |  |  |   setPostBodyComponents([ | 
					
						
							|  |  |  |     <script | 
					
						
							|  |  |  |       async='true' | 
					
						
							|  |  |  |       key='chai-CDN' | 
					
						
							|  |  |  |       src='https://cdnjs.cloudflare.com/ajax/libs/chai/4.1.2/chai.min.js' | 
					
						
							|  |  |  |     /> | 
					
						
							|  |  |  |   ]); | 
					
						
							| 
									
										
										
										
											2018-04-18 11:15:32 +01:00
										 |  |  | }; |