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

feat: globalMiddleware option #163

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

felix-dolderer
Copy link
Contributor

@felix-dolderer felix-dolderer commented Aug 16, 2024

πŸ”— Linked issue

Closes #114

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Adds a configuration option that adds a global middleware. This option requires being logged in for all pages (unless otherwise specified on the individual page)

Exposes and auto-imports the middleware functions (hankoLoggedIn, hankoLoggedOut) so they can be imported in a simple and typesafe way.

ℹ️ Help / Review wanted

  1. I'm not sure if auto-importing the existing middleware functions (hankoLoggedIn, hankoLoggedOut) is necessary or the best way to make them accessible for building custom middleware on top of them.
  2. How can I write tests for the logged-in behaviour? I logged in with my demo Hanko-API, took my current cookie and used that to make sure my tests were passing. This approach is obviously hard to replicate for other people who want to run the tests. (Addition: And it breaks automated testing.)

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.

Global middleware option
1 participant