0👍
You should use store.getters.variable_name to retrieve state value.
Sample code for retrieving accessToken:
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
accessToken: null
},
getters: {
accessToken: state => state.accessToken
},
actions: {
doSomethingsHere({ commit }, somethingData) {
console.log('accessToken: ' + store.getters.accessToken)
}
}
})
export default store
- [Vuejs]-Vue.js in Laravel
- [Vuejs]-Unrecognized Content-Security-Policy directive 'worker-src' When using client-only Stripe redirect to checkout
Source:stackexchange.com