[Vuejs]-Having trouble updating Nuxt layout dynamically

0👍

After switching to SSR mode I was able to better debug, I figured that the beforeCreate hook is called after the layout is mounted after switching to SSR which I should have realized after seeing this image on the nuxt documentation. So I realized the isAuth state getter was being checked before the authentication happening in the beforeCreate where I was supposed to be checking the sessionStorage.

https://nuxtjs.org/guide/views

Also found this to help out authentication using middleware.

https://auth.nuxtjs.org/

I solved my problem but am still insecure about my design patterns so still open to criticism and please correct me if there is anything wrong with my answer!


EDIT

I found an example which really helped me out, if anyone else is struggling with authentication with firebase and nuxt check out the following example by davidroyer.

https://github.com/davidroyer/nuxt-ssr-firebase-auth.v2

Leave a comment