async componentDidMount()

in assets/src/modules/bestSellers/BestSellers.tsx [25:42]


  async componentDidMount() {
    try {
      const books = [];
      const bestSellers = await API.get("bestsellers", "/bestsellers", null);
      
      // Map the elasticache results to a book object
      for (var i = 0; i < bestSellers.length; i++) {
        var hit = JSON.parse(bestSellers[i]);
        books.push({ bookId: hit });
      }
      this.setState({
        books: books,
        isLoading: false
      });
    } catch(error) {
      alert(error);
    }
  }