i18next / i18next-express-middleware

[deprecated] can be replaced with i18next-http-middleware
https://github.com/i18next/i18next-http-middleware
MIT License
206 stars 52 forks source link

Refresh cookie expires value for each request #174

Closed dwybourn closed 5 years ago

dwybourn commented 5 years ago

Hi

Looking at the documentation and the code, it looks like there isn't a way to set the cookie expires date to refresh for each request. i.e. we'd like the cookie to expire 30 minutes after the last request. Am I right in assuming that this isn't possible at the moment? If so would you mind if I create a PR to add a maxage functionality?

Thanks David

jamuhl commented 5 years ago

https://github.com/i18next/i18next-express-middleware/blob/master/src/languageLookups/cookie.js#L21 -> not 100% sure if this gets called on each request never was to important to us as the language get changed once and is cached either in cookie, session, whatever for the needed duration

is there a specific use case you like to extend the duration on every request?

dwybourn commented 5 years ago

Our service is a basically an application consisting of multiple different form pages. A lot of our users will be using shared computers and aren't very technically illiterate and take a long time to go through the application. We don't want the next user to see the previous user's language.

We figured having the session set to 30 minutes would suffice providing the expiration refreshed with every page.

jamuhl commented 5 years ago

make it a day - and no need to refresh it on each request...but if you prefer doing a refresh on each request...go ahead ... PR's are always welcome (if not adding to much complexity ;))

jamuhl commented 5 years ago

closing due inactivity