feature: pass request to render:route hook

This commit is contained in:
Clark Du 2018-02-04 00:43:29 +08:00 committed by Pooya Parsa
parent 1582df149d
commit 28d28cb8c1
2 changed files with 2 additions and 2 deletions

View File

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

View File

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