title: I am trying to use data pulled from one axios get request to make a series of axios get request to the Google Books API
body: <p>I have a database on MongoDB that contains information about books. In react, I am making an axios get request to this database and retrieving an array of 20 objects. I update state with the value of that array. My goal is to map through that array, and using the isbn numbers for each item in the array, make a get request to the Google Books API. I want to match the isbn number from my database to the isbn in the google database to retrieve the cover image for each book. However, when I make the second axios request, sometimes it is successful, but other times I get this error:</p>
  
  <p>createError.js:17 Uncaught (in promise) Error: Request failed with status code 403 at createError (createError.js:17)at settle (settle.js:19)at XMLHttpRequest.handleLoad</p>
  
  <p>I tried using the solution from this post: <a href="https://stackoverflow.com/questions/52772322/my-axios-call-is-returning-a-404-error-react-express">My Axios call is returning a 404 error, React/Express</a></p>
  
  <p>And I think my questions is similar to this one: 
  <a href="https://stackoverflow.com/questions/49640466/make-multiple-axios-request-from-response-from-an-axios-request">Make multiple axios request from response from an axios request</a></p>
  
  <pre><code>class Booklist extends Component {
    constructor(props) {
      super(props);
      this.state = {
        data: [],
        googleThumbnail: []
      };
      this.showBooks = this.showBooks.bind(this);
    }
  
    showBooks() {
      let url = "";
      if (process.env.NODE_ENV === "production") {
        url = process.env.DB_URL;
      } else {
        url = "http://localhost:8080/books";
      }
  
      axios.get(url).then(res =&gt; {
        // console.log(res.data);
        let bookData = res.data;
        this.setState({ data: bookData });
        console.log(bookData);
        bookData.map(item =&gt; {
          if (item.isbns.length &gt; 0) {
            let url2 = `https://www.googleapis.com/books/v1/volumes?q=isbn:${item.isbns[0].isbn13}`;
            return axios.get(url2).then(result =&gt; {
              console.log(result);
            });
          }
        });
      });
    }
  
    render() {
      return (
        &lt;div&gt;
          {this.state.data.map(item =&gt; {
            return (
              &lt;Book
                key={item._id}
                title={item.title}
                author={item.author}
                description={item.description}
                // src={this.state.googleThumbnail}
              &gt;&lt;/Book&gt;
            );
          })}
  
          &lt;button className="btn btn-primary btn-lg" onClick={this.showBooks}&gt;
            See All Our Books
          &lt;/button&gt;
        &lt;/div&gt;
      );
    }
  }
  export default Booklist;
  </code></pre>