File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
app/server/middlewares/custom Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import settings from 'server/initializers/settings';
44
55export default async ( ctx , next ) => {
66 ctx . render = ctx . render ||
7- function ( template : string , parameters : Object = { } ) {
7+ function ( template : string , parameters : Object = { } , initialState : Object = { } ) {
88 ctx . type = 'text/html' ;
99
1010 return new Promise ( resolve => {
@@ -13,10 +13,18 @@ export default async (ctx, next) => {
1313 ? global . nodeRequire ( `${ templatePath } .js` )
1414 : marko . load ( templatePath ) ;
1515
16+ const builtParameters = {
17+ ...parameters ,
18+ prerenderData : {
19+ ...initialState ,
20+ ...parameters . prerenderData ,
21+ } ,
22+ } ;
23+
1624 resolve (
1725 currentTemplate . stream ( {
1826 ...settings ,
19- ...parameters ,
27+ ...builtParameters ,
2028 csrf : ctx . csrf ,
2129 } )
2230 ) ;
You can’t perform that action at this time.
0 commit comments