Closed toniengelhardt closed 2 years ago
Could you tell me about the version of nuxt that you are using and the environment?
And in my case, global Middleware has a lot of problems, so I don't use it, but I usually use it by inserting the source code from a file in pages/*. Eventually, it also runs isLoggedIn on the server side, so it works the same way as middleware.
if($auth.isLoggedIn)
router.push({name:''});
@zaeval thanks for taking a look!
I'm using the latest nuxt-edge
version, currently nuxt@3.0.0-rc.13-27768654.09e5534
with ssr: false
.
modules: [
// ...
'@nuxtjs-alt/auth',
'@nuxtjs-alt/http', // Needed for alt auth.
// ...
]
I also have this global middleware:
export default defineNuxtRouteMiddleware((to, from) => {
if (to.path === '/') {
return navigateTo('/write', { redirectCode: 301 })
}
})
Not sure if that interferes somehow?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Scenario: I'm logged out and have some redirects defined like
The login page has
while the
/write
page uses the default layout.When I try to load a page that is protected by auth, e.g.
/write
I'm correctly redirected, but get this errorand the styles are messed up.
I can also see that the code in default layout
onMounted
is executed before the redirect, which should not be the case, aka. the/write
page should not be mounted at all right?