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
}
})
- [Vuejs]-Cannot trigger function when clicking logo
- [Vuejs]-Accessing the Vue instance inside a component in Laravel Inertia
Source:stackexchange.com