I'm trying to write a callback function that returns an array of all the posts of a given category from a wordpress blog so i can pull this data into a static site compiler.

[The API](https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/posts/) only returns 100 at a time so i have to loop through them page by page and add them to an array.

I've managed to loop through them and log them to the console but i can't work out how to add them to an array while using promises. I'm not sure what arguement i should pass to `push()`

any pointers would be appreciated.

```
const getData = (category, number = 0, page = 1) =>
  fetch(`https://public-api.wordpress.com/rest/v1/sites/www.accessaa.co.uk/posts?category=${category}&number=${number}&page=${page}&order_by=date`)
    .then(res => res.json())

const found = (category) =>
  getData(category)
    .then(json => json.found)

var total = new Promise(function(resolve, reject) {
  resolve(found('news'))
})

var times = total.then(function(value) {
   return Math.ceil(value/100)
})

var calls = times
  .then(function(callsToMake) {
    items = []
    for (i = 1; i < callsToMake; i++) {
      getData('news', 100, i)
        .then(json => json.posts)
        .then(items.push(posts))
    }
    return items
  })

```