From 215832769edc42e7077e8db970fbcda3276ecf0a Mon Sep 17 00:00:00 2001 From: Clark Du Date: Sun, 4 Feb 2018 20:42:26 +0800 Subject: [PATCH] refactor: add context as third param of render:route hook --- examples/with-amp/nuxt.config.js | 2 +- lib/core/middleware/nuxt.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/with-amp/nuxt.config.js b/examples/with-amp/nuxt.config.js index 75986508b4..6ae265293c 100644 --- a/examples/with-amp/nuxt.config.js +++ b/examples/with-amp/nuxt.config.js @@ -31,7 +31,7 @@ module.exports = { page.html = modifyHtml(page.html) }, // 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) } } diff --git a/lib/core/middleware/nuxt.js b/lib/core/middleware/nuxt.js index 3ab2be4bfb..39835d1288 100644 --- a/lib/core/middleware/nuxt.js +++ b/lib/core/middleware/nuxt.js @@ -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, result) + await this.nuxt.callHook('render:route', req.url, result, context) const { html, cspScriptSrcHashes,