Answer the question
In order to leave comments, you need to log in
How to use localStorage in axios request in vuex?
Good afternoon, how to fix the configuration?
import Vue from 'vue'
import axios from 'axios'
import vuex from 'vuex'
Vue.use(vuex, axios);
export default new vuex.Store({
state: {
ParamsAffiliate: '',
},
mutations:{
setParams(state, payload){
state.ParamsAffiliate = payload;
}
},
actions: {
async getParams({commit, state}){
let response = await axios.get('/information/userbar');
if (response.status === 200) {
commit('setParams', response.data);
}
}
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question