I seem to be unable to find a way to successfully access getters from within a module, the getter requires a parameter in order to search an object within state of the same module.
For example:
// store/todo.js
export const getters = {
getTodoById: (state) => (id) => {
return state.todos.find(todo => todo.id === id)
}
}
// a component.vue
store.getters.todos.getTodoById(2)I get the response:
Cannot read property 'getTodoById' of undefined
I assume this should be possible? Where might I be going wrong?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2364">#c2364</a>)</em></sub></div>