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

[FEATURE REQUEST] Session Async Methods #952

Open
angelhdzdev opened this issue Jul 29, 2023 · 0 comments
Open

[FEATURE REQUEST] Session Async Methods #952

angelhdzdev opened this issue Jul 29, 2023 · 0 comments

Comments

@angelhdzdev
Copy link

I suggest making the methods of the session object in the request async , mostly for session.destroy.

I've found myself doing this in NestJS:

return new Promise(resolve => session.destroy(() => resolve())

Would become:

@Get('logout')
public logout(): Promise<void> {
  return session.destroy() 
}

and:

@Get('logout')
public async logout(): Promise<void> {
  await session.destroy() // Promise<void>
  Logger.log('Destroying the session...')
  return
}

And making the callback optional.

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

No branches or pull requests

2 participants