[Vuejs]-How I can call NuxtServerInit correctly?

0👍

Try calling your API like this in your vuex actions:

export const actions = {
    async nuxtServerInit({ commit }, { req }) {
        const res = (await this.$axios.$get('https://api/news.json')).data
        commit('SET_NEWS', res)
    },
}

Leave a comment