I am facing a challenge in my application where I require certain data to be loaded into the VueX store before routing can commence, such as user sessions.
An example scenario that showcases a race condition is as follows:
// Defined routes
{
name: 'login',
path: '/login',
component: Login,
meta: {
goToIndexIf: () => store.getters['auth/loggedIn']
}
}
In this case, the route guard may execute before the user information has been fetched from the server.
Even though I attempted conditional rendering, it did not solve the issue as the route guards function regardless of whether
<router-view v-if="storeReady">
is present in the rendered template or not.
Is there a way for me to ensure that all my routing operations wait for asynchronous data to be loaded?