Static GitHub Issues

[978] How to send multiple requests in asyncData

prev: Is it possible to use file-system packages inside nuxtServerInit?
next: latest update bug

Sorry, I'm not good at english! This is my asyncData method :

export default {
  async asyncData({ query, error }) {
    return axios.all([
      axios.get('/api/post/page/0'),
      axios.get('/api/post/count/published')
    ]).then(axios.spread((pageRes, countRes) => {
      return {
        posts: pageRes.data.list,
        total: countRes.data.result
      }
    })).catch((err) => {
      error({ statusCode: 404, message: err.message })
    })
  }
}

I want to send multiple requests in asyncData,but it doesn't work,here is error information:

(node:9360) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: __WEBPACK_IMPORTED_MODULE_2__plugins_axios__.a.all is not a function
<!--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/c853">#c853</a>)</em></sub></div>