Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Additional check for a function for the Cookie Expiration #671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jawa-the-hutt
Copy link

@jawa-the-hutt jawa-the-hutt commented Dec 7, 2021

With this PR, you can now update the cookie expiration dynamically based on a function call. Addresses #669

Cookie can be setup as such:

cookie: {
  Path: '/',
  Secure: true,
  Expires: expiresAt(),  // accepts a custom function name and parameters if needed
  SameSite: 'Strict'
},

@websanova
Copy link
Owner

Hmm, not quite sure what you're trying to achieve now, if you want to pass a function I think it should be like this.

if (typeof val === 'string') {
    return val;
}
else if (typeof val === 'function') {
    return val();
}

Otherwise it will just return a function. But not sure if you're having something else in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants