indomie858 / flygames

FlyGames React Website
1 stars 0 forks source link

Homepage API Setup #7

Closed dpalencia closed 3 years ago

dpalencia commented 3 years ago

This PR contains the following changes.

  1. Set up a .env file containing API keys as well the .gitignore to ignore it in git, so we don't push them to the public repo.
  2. Refactored the Axios/API code into a new class, located in /utils/APIUtility.js. Allows us to use a more abstracted API in our code. Set up the API calls as methods, with one method retrieving the "top 10 games". Could maybe rename this method if we want to generalize the code more.
  3. Set up a basic API call in App.js with a map function to demonstrate retrieval of game data. I set it up to display the titles of the 10 retrieved video games. This is done by setting a state variable in componentDidMount().