Last active
September 1, 2017 06:51
-
-
Save whs/3a30d11db7e3530ccd49cee39550a151 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function renderSuccessPage(req, res, renderProps, store, next, statusCode = 200) { | |
| setImmediate(() => { | |
| try { | |
| res.header('Content-Type', 'text/html; charset=utf-8') | |
| const content = { | |
| html: ReactDOMServer.renderToString(<Root store={store} renderProps={renderProps} />), | |
| store: store.getState().toJSON(), | |
| head: Helmet.rewind(), | |
| lang: getLanguage(req) | |
| } | |
| res.status(statusCode).end(renderHtml(content)) | |
| } catch (err) { | |
| console.error('[ERROR][ROS1][REQ]', req.originalUrl) | |
| console.error(err) | |
| next(err) | |
| } | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment