vue-auth icon indicating copy to clipboard operation
vue-auth copied to clipboard

Add Additional check for a function for the Cookie Expiration

Open jawa-the-hutt opened this issue 3 years ago • 1 comments

With this PR, you can now update the cookie expiration dynamically based on a function call. Addresses https://github.com/websanova/vue-auth/issues/669

Cookie can be setup as such:

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

jawa-the-hutt avatar Dec 07 '21 15:12 jawa-the-hutt

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?

websanova avatar Dec 09 '21 20:12 websanova