mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
refactor: add context as third param of render:route hook
This commit is contained in:
parent
28d28cb8c1
commit
215832769e
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user