[Vuejs]-Filtering Axios response

3๐Ÿ‘

โœ…

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!

Leave a comment