Static GitHub Issues

[424] Use vuex helper functions

prev: Generate valid html
next: Axios interceptors

Hi guys, I'm migration my code from vanilla vue.js to nuxt.js. Congrats on this btw.

I'm trying to make use of vuex helper functions like mapActions or mapGetters but I can't access to the methods. Please consider the following code snippet:

methods: {
  ...mapActions('searchView', {
    searchRequest: actionTypes.SEARCH_REQUEST,
    clearState: actionTypes.SEARCH_CLEAR_STATE,
    setPageSize: actionTypes.SEARCH_PAGE_SIZE_SET
  })
},

fetch (context) {
  const requestParams = context.route.query
  this.searchRequest(requestParams)
},

This returns:

this.searchRequest is not a function

What am I missing here?

<!--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/c373">#c373</a>)</em></sub></div>