refactor: add context as third param of render:route hook

This commit is contained in:
Clark Du 2018-02-04 20:42:26 +08:00 committed by Pooya Parsa
parent 28d28cb8c1
commit 215832769e
2 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ module.exports = {
page.html = modifyHtml(page.html) page.html = modifyHtml(page.html)
}, },
// This hook is called before rendering the html to the browser // This hook is called before rendering the html to the browser
'render:route': (req, page) => { 'render:route': (url, page, { req, res }) => {
page.html = modifyHtml(page.html) page.html = modifyHtml(page.html)
} }
} }

View File

@ -10,7 +10,7 @@ module.exports = async function nuxtMiddleware(req, res, next) {
res.statusCode = 200 res.statusCode = 200
try { try {
const result = await this.renderRoute(req.url, context) const result = await this.renderRoute(req.url, context)
await this.nuxt.callHook('render:route', req, result) await this.nuxt.callHook('render:route', req.url, result, context)
const { const {
html, html,
cspScriptSrcHashes, cspScriptSrcHashes,