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

chore(#892): rename middleware to avoid conflicts #957

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

zoey-kaiser
Copy link
Member

@zoey-kaiser zoey-kaiser commented Dec 12, 2024

πŸ”— Linked issue

Closes #892

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ 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

This PR renames our internal middleware from auth to sidebase-auth. This is a quality of life change, as many people like to write their own authentication middleware on top of ours, or want to replace it.

A logical name for this middleware is often auth, however this results in nuxt warning messages, as it conlides with our built-in middleware. As the middleware name of our module does not have a big impact on our development or the usage inside the app, I renamed the middleware to sidebase-auth to free up the auth middleware name.

This PR does contain a breaking change, as when you want to add the middleware to a page, you need to change the following:

definePageMeta({
-  middleware: 'auth'
+  middleware: 'sidebase-auth'
})

This only impacts the case where you globally disable the middleware and only want to enable it on a certain page. However, configuring the middleware via the page meta remains unchanged:

definePageMeta({
  auth: {
    unauthenticatedOnly: false,
    navigateUnauthenticatedTo: '/auth/signin'
  }
})

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

Copy link

pkg-pr-new bot commented Dec 12, 2024

Open in Stackblitz

npm i https://pkg.pr.new/@sidebase/nuxt-auth@957

commit: 15f3cad

@zoey-kaiser zoey-kaiser added enhancement An improvement that needs to be added breaking-change A change will changes that require at least a minor release. labels Dec 12, 2024
phoenix-ru
phoenix-ru previously approved these changes Dec 12, 2024
@zoey-kaiser zoey-kaiser merged commit 37b0c65 into main Dec 12, 2024
7 checks passed
@zoey-kaiser zoey-kaiser deleted the 892/rename-sidebase-middleware branch December 12, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change A change will changes that require at least a minor release. enhancement An improvement that needs to be added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting a Nuxt WARN while defining local middleware for pages protection
2 participants