Prefetch inside app.vue only executed after router calls beforeEnter



  • I want to subscribe to firebase.auth state inside the app.vue and fill the store with the user data. I thought this should run only one time at app startup similar to the previously used boot plugin. Inside the router I ask the store if the user is logged in and proceed depending on the state.

    But currently the router calls beforeEnter before the app.vue prefetch is executed, meaning the user is never logged in at first run.

    How can I change this behavior or is there a better place to subscribe to firebase.auth state?



  • This!
    I’m in the same situation.
    I need to authenticate with an API call only once at start up and get the result before that the Router.beforeEach kicks in. I saw that the boot plugin will be deprecated in the next version so what’s the solution here?



  • It’s been 2 month, did you find the solution @snp ?