I use nuxt and nuxt-auth-next, With a laravel api backend.
When i completely close browser and load the page nuxt cannot read cookies on server-side
and wont be able to understand that i am logged in, and on client-side
it understands that i have cookie so there will be a difference in my server-side
and client-side
loading some component based on user being logged in, and then, obviously, this will happen:
[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.
Now when i refresh this page. the problem will go away and everything will be ok.
I also checked if cookies are not availble on server-side
when loading for the first time:
if (process.client) {
console.log('cookie = ', this.$cookies.get('auth._token.laravelJWT'));
} else {
console.log('cookie = ', this.$cookies.get('auth._token.laravelJWT'));
}
The result on console will be this:
Nuxt SSR
cookie = undefined
Client:
cookie = Bearer blablabla