Skip to content
This repository was archived by the owner on Jul 24, 2025. It is now read-only.

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

Open
jawa-the-hutt wants to merge 1 commit intowebsanova:masterfrom
jawa-the-hutt:master
Open

Add Additional check for a function for the Cookie Expiration#671
jawa-the-hutt wants to merge 1 commit intowebsanova:masterfrom
jawa-the-hutt:master

Conversation

@jawa-the-hutt
Copy link
Copy Markdown

@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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants