root app's component



  • I want to modify my root app’s component as code below. How can I reach same behaviour in boot file?

    store.dispatch('auth/loginAttempt', localStorage.getItem('token'))
        .then(() => {
            const app = new Vue({
                el: '#app',
                i18n,
                router,
                store,
                components: {
                    App
                }
            });
        })
    


  • @gregor87 I’m not really sure you can, but the boot function can be async, so you should be able to just await the store action



  • Indeed, this solves the issue

    export default async ({ Vue, store }) => {
    await store.dispatch(‘auth/loginAttempt’, localStorage.getItem(‘token’))
    };


Log in to reply