пишу spa на vue&vuex, использую devtools vue для отслеживания состояния, но он почему то показывает state который изменён с помощью mutations, а с помощью actions не показывает. В чём может быть проблема ?
Компонент
<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>
store
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"/>