[Vuejs]-Vuex await promise before performing router actions

0👍

You have to store the user data also in browser LocalStorage then retrieve that data across page refreshes.
First use LocalStorage.setItem(‘user’, userData) to store user data when he/she logged in.
Then in your state:

const store = new Vuex.Store({
  state: {
    loggedIn: localStorage.getItem('user') ? true : false, // the key part
  }
})

Leave a comment