[Vuejs]-Vuex mutation doesn't seem to be updating state on load

3👍

You need to pass your store to your app instance.

import store from './store' // correct path to your store

new Vue({
  router,
  store,  <---
  // ...
})

I don’t understand why you wrap your Vue app in a setTimeout.

I suggest you read the Vuex documentation. You are doing asynchronous work in a mutation, where this type of thing belongs in an action.

👤Phil

Leave a comment