samedi 24 juillet 2021

Iterating over the nested Array in APi

I am trying to learn ember through building stuff, but now I am kind of stuck with looping through the nested array, Api is mine, so you can visit to see the data, anyway, the thing I am trying to accomplish is this, I want to display the category property, in this nested array I would like some help if possible.

import Route from '@ember/routing/route';
export default class BooksRoute extends Route {
  async model(){
    let response = await fetch('https://json-api-smaiil.herokuapp.com/books');
    let parsed = await response.json()
    console.log(parsed)
    return parsed.map((book) =>{
      let {categories} = book
    })
  }
}




Aucun commentaire:

Enregistrer un commentaire