Home

Issue: 3195

Server Side rendering in Nuxt Axios module proxy URL

[issue link]

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.

This question is available on Nuxt.js community (#c6851)