Q:

Filtering Axios response

I'm trying to filter an axios response.  My latest attempt the filter appears to be working, but my components aren't getting the expected data, only the correct # of records.
methods: {
    loadItems() {

      // Init variables
      var self = this
      var app_id = "ID";
      var app_key = "KEY";
      this.items = []
      axios.get(
        "https://api.airtable.com/v0/"+app_id+"/Pages",
        { 
          headers: { Authorization: "Bearer "+app_key } 
        }
      ).then(function(response){
        self.items = response.data.records.filter(item => item.fields.fxPage == 'TestPage');
        response.data.records.map((item)=>{

          return {
              id: item.id,
              ...item.fields
          }
        })
      }).catch(function(error){
        console.log(error)
      })
    }
  }

A:

So close!
the .map() method returns a NEW array, so the map in that case is just returning and not getting used anywhere (e.g saving to a variable), what I would do would be to attach the map after the filter. e.g
self.items = response.data.record.filter(item => item.fields.fxPage === "TestPage").map(item => {
   return {
      id: item.id,
      ...item.fields
   }      
})

I hope this helps!

