I have an nuxt app with modules state:
- Store
- index.js, state.js, mutations.js, actions.js, getters.js
- Modules
- Posts
- index.js, state.js, mutations.js, actions.js, getters.js
In Store/index.js I have:
import state from './state'
import * as actions from './actions'
import * as mutations from './mutations'
import * as getters from './getters'
import posts from './modules/posts'
export default {
state,
getters,
mutations,
actions,
modules: {
posts
}
}
Inside Store/state.js I have:
export default () => ({
test: null
})
Inside Store/Modules/Posts/index.js I have:
import state from './state'
import * as actions from './actions'
import * as mutations from './mutations'
import * as getters from './getters'
export default {
namespaced: true,
state,
getters,
mutations,
actions
}
And inside Store/Modules/Posts/state.js I have:
export default () => ({
dialog: false,
test: false
})
My store now has duplicated everything from getters, actions etc. Should it be that way or not? Am I using store how I should or not? When I remove modules from base inldex.js I have one of everything but then, everything is undefined.
Store output example: