I have a root store with states, mutations and getters. It also exports modules (sub stores). When inspecting it in chrome Vue.js devtools v6.6.3 it only shows the modules. I don’t see any states or getters related to the root store itself. Is there an obvious error in this example?
import { createStore } from 'vuex'
import axios from 'axios'
export default createStore({
modules: {
someSubStore,
},
state: {
myItems: {
items: [],
},
},
mutations: {
SET_ITEMS: (state, items) => {
state.myItems.items = items
},
},
actions: {
loadItems: ({ commit, dispatch }) => {
return new Promise((resolve, reject) => {
axios.get(`/api/items`).then(
({ data }) => {
commit('SET_ITEMS', data)
resolve(data)
},
({ response }) => {
reject(response)
},
)
})
},
},
getters: {
myItems: (state) => state.myItems.items,
},
})
I tried to inspect this in Chrome Vue.js devtools v6.6.3 and I am expecting to also be able to see the states and getters of the root store.
New contributor
Anders Bille is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.