feat: #9533, allow redirect in build hooks

v1.18.x
Barış Soner Uşaklı 4 years ago
parent d8a8864cee
commit f6b583bb9d

@ -34,9 +34,15 @@ module.exports = function (middleware) {
options.bodyClass = buildBodyClass(req, res, options);
const buildResult = await plugins.hooks.fire(`filter:${template}.build`, { req: req, res: res, templateData: options });
if (res.headersSent) {
return;
}
const templateToRender = buildResult.templateData.templateToRender || template;
const renderResult = await plugins.hooks.fire('filter:middleware.render', { req: req, res: res, templateData: buildResult.templateData });
if (res.headersSent) {
return;
}
options = renderResult.templateData;
options._header = {
tags: await meta.tags.parse(req, renderResult, res.locals.metaTags, res.locals.linkTags),

Loading…
Cancel
Save