Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Fix expiryInSeconds = null has no effect #51

Merged
merged 6 commits into from
Dec 5, 2022

Conversation

interpretor
Copy link
Contributor

Closes #38.

Checklist:

  • issue number linked above after pound (#)
    • replace "Closes " with "Contributes to" or other if this PR does not close the issue
  • manually checked my feature / checking not applicable
  • wrote tests / testing not applicable
  • attached screenshots / screenshot not applicable

Properties with null values aren't copied by defu.
As mentioned here, we would need to exchange defu with another module which doesn't ignore null, or change the expiryInSeconds option to use false instead of null.

I also changed the domain property type, as it is also affected, but currently doesn't make any problems, because null is the default value here.

@interpretor interpretor changed the title Fix #38 Fix expiryInSeconds = null has no effect Nov 30, 2022
@@ -10,7 +10,7 @@ import { useRuntimeConfig } from '#imports'
const SESSION_COOKIE_NAME = 'sessionId'
const safeSetCookie = (event: H3Event, name: string, value: string, createdAt: Date) => {
const sessionOptions = useRuntimeConfig().session.session as SessionOptions
const expirationDate = sessionOptions.expiryInSeconds
const expirationDate = sessionOptions.expiryInSeconds !== false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BracketJohn We should also check here for explicit boolean/false value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, good catch

@BracketJohn BracketJohn merged commit b0af98e into sidebase:main Dec 5, 2022
@interpretor interpretor deleted the fix-expiryinseconds-null branch December 5, 2022 11:31
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.

Setting expiryInSeconds to null has no effect
2 participants