[Vuejs]-Properly written init method within module action

0👍

If all you’re trying to do is use async/await with axios in nuxtServerInit:

export default function nuxtServerInit ({ commit, dispatch }, { req, res }) {
  try {
    await dispatch('core/load')     
  } catch (err) {

  }
}

And in your module:

async load() {
  return await this.$axios....
}

Leave a comment