I am building authentication system in laravel and vuejs, I am building using JWT and storing token in lacalstorage. I am able to store user data in vuex store and yes i can see under vuex area in devtool. The problem is when i am refreshing page i am losing it . I wanna persist user's information, It should not get deleted on a page refresh . How can i achieve that
import Vue from 'vue'
import Vuex from 'vuex'
import userStore from './components/user/userStore'
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'
export default new Vuex.Store({
modules : {
userStore
},
strict : debug
})
You can try using this plugin
https://github.com/championswimmer/vuex-persist
A Typescript-ready Vuex plugin that enables you to save the state of your app to a persisted storage like Cookies or localStorage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With