-
Notifications
You must be signed in to change notification settings - Fork 123
-
Notifications
You must be signed in to change notification settings - Fork 123
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
Make login page automatically redirect to homepage when logged in #342
Comments
I'd actually advocate against this. I was not a fan when the feature was added that by default it routes you to the login page. Now I find myself adding the same lines to my nuxt config every project time supabase: {
redirect: false
} I'd prefer to handle this on my own in middleware: export default defineNuxtRouteMiddleware(async () => {
const user = useSupabaseUser()
if (!user.value) {
return navigateTo('/login')
}
}) This is just my $0.02 though. |
You could create a global auth to check if route is login and user exist
|
I know how to make middleware's😅 |
I agree, it was one of first things I checked haha |
Is your feature request related to a problem? Please describe.
I think it would be necessary for the login-page to automatically redirect to the hompeage when the user is already logged in. I don't understand why the user is able to access the login-page when user is already logged in...
Describe the solution you'd like
Make an included middleware that handles this, as i don't want to keep making the same middleware for each project.
Describe alternatives you've considered
I've considered making the middleware myself, but it just takes too much time for each project.
Thanks
The text was updated successfully, but these errors were encountered: