(req, res, next)
| 18 | } |
| 19 | |
| 20 | export default async function productGroups(req, res, next) { |
| 21 | // It's important to use `req.pathPage` instead of `req.path` because |
| 22 | // the request could be the client-side routing from Next where the URL |
| 23 | // might be something like `/_next/data/foo/bar.json` which is translated, |
| 24 | // in another middleware, to what it would equate to if it wasn't |
| 25 | // client-side routing. |
| 26 | if (isHomepage(req.pagePath)) { |
| 27 | const { pages } = await warmServer() |
| 28 | req.context.productGroups = getProductGroups(pages, req.language) |
| 29 | } |
| 30 | |
| 31 | return next() |
| 32 | } |
nothing calls this directly
no test coverage detected