[Vuejs]-How to send multiple API request to vuex store from nuxt-middleware?

0👍

Hey in my case it worked absolute fine when you remove the second return

import axios from 'axios';
async asyncData( {store} ){
    return axios.all([
        axios.get('http://my/api'),
        axios.get('http://my/api2')
    ]).then(axios.spread((first, second) => {
            store.commit('add', first.data);
            store.commit('sub', second.data);
            // posts: first.data,
            // total: second.data
    })).catch((err) => {
      error({ statusCode: 404, message: err.message })
    })

}

Leave a comment