Skip to content

Commit

Permalink
preserve original querystring parameters by appending them with lng
Browse files Browse the repository at this point in the history
  • Loading branch information
KhodorAmmar committed Dec 16, 2018
1 parent ba1c5f1 commit 2c3cb59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middlewares/next-i18next-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export default function (nexti18next, app, server) {
server.get(/^\/(?!_next|static).*$/, lngPathDetector)
server.get(`/:lng(${allLanguages.join('|')})/*`, (req, res) => {
const { lng } = req.params
const { query } = req
const url = parse(req.url).pathname
app.render(req, res, url.replace(`/${lng}`, ''), { lng })
app.render(req, res, url.replace(`/${lng}`, ''), { lng, ...query })
})
}
}

0 comments on commit 2c3cb59

Please sign in to comment.