Answer the question
In order to leave comments, you need to log in
Vuex Devtools not seeing actions?
I write spa on vue & vuex, I use devtools vue to track the state, but for some reason it shows the state that is changed using mutations, but does not show it using actions. What could be the problem ?
Component
<script>
export default {
data() {
return {
search: '',
users: []
}
},
methods: {
async submitHandler() {
this.$store.commit('test')
await this.$store.dispatch('fetchUsers', this.search)
this.search = ''
this.fetchUsers()
},
fetchUsers() {
this.users = this.$store.state.users
console.log(this.users);
}
}
}
</script>
import Vuex from "vuex";
import Vue from "vue";
Vue.use(Vuex)
export default new Vuex.Store({
state: {
users: []
},
actions: {
async fetchUsers({commit, state}, {req}) {
const response = await fetch(`https://api.github.com/search/users?q=${req}`)
state.users = await response.json()
}
},
mutations: {
test(state){
state.test = 1
}
}
})
<img src="https://habrastorage.org/webt/60/2d/5b/602d5b0e32043433064995.png" alt="image"/>
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