You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow instructions with Latest version of nuxt, vuefire and nuxt-fire
Steps to reproduce the bug
This middleware won't work when you reload the page manually from the reload button of the browser of navigating to specific link:
// middleware/auth.ts
export default defineNuxtRouteMiddleware(async (to, from) => {
const user = await getCurrentUser()
// redirect the user to the login page
if (!user) {
return navigateTo({
path: '/login',
query: {
redirect: to.fullPath,
},
})
}
})
Expected behavior
When an user is logged in, it does not redirect to login page either navigating clicking either reloading or going to a specific URL directly
Actual behavior
When an user is logged in, it does not redirect to login page if we are navigating clicking
BUT IT DOES NOT WORK AS EXPECTED WHEN either reloading or going to a specific URL directly
Additional information
Problem is that the middleware does not wait to the user to be loaded from firebase, it executes before so the users is not loaded.
I have SSR Enabled in my nuxt.config.ts:
routeRules: {
"**": { prerender: true },
},
If I change it and add the route I want to go a spa, the middleware actually works as expected in that specific route (in this case '/profile':
Reproduction
Follow instructions with Latest version of nuxt, vuefire and nuxt-fire
Steps to reproduce the bug
This middleware won't work when you reload the page manually from the reload button of the browser of navigating to specific link:
Expected behavior
When an user is logged in, it does not redirect to login page either navigating clicking either reloading or going to a specific URL directly
Actual behavior
When an user is logged in, it does not redirect to login page if we are navigating clicking
BUT IT DOES NOT WORK AS EXPECTED WHEN either reloading or going to a specific URL directly
Additional information
Problem is that the middleware does not wait to the user to be loaded from firebase, it executes before so the users is not loaded.
I have SSR Enabled in my
nuxt.config.ts
:If I change it and add the route I want to go a spa, the middleware actually works as expected in that specific route (in this case '/profile':
The text was updated successfully, but these errors were encountered: