As I'm trying to use Nuxt and Nuxt/Axios module first time can any one help!!!
I'm using Axios module officially provided by Nuxt.js here, https://github.com/nuxt-community/axios-module.
How can I call action "SET_NEW_DEAL" from component in fetch method?
async fetch ({ store }) { await store.dispatch('SET_NEW_DEAL',store.getters.newDeal.page); } Is this correct?
Mine Acions file api request as below:
export default { async SET_NEW_DEAL ({commit}, payload) {
return this.$axios.$get(`/api/?page=${payload}`)
.then((response) => {
if (response.status == 200) {
commit('SET_NEW_DEAL',response.data);
}
}).catch((error) => {
console.log(error)
})
}
} Not able to hit api request, thus not able to commit mutation and so on.
I'm using proxy url configuration in nuxt.config.js also.
<!--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/c6851">#c6851</a>)</em></sub></div>