Guest User

Untitled

a guest
Feb 13th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. getLeagueMatches = () => {
  2. let allLeagues = []
  3. if(this.state.leagueMatchesInfo != null){
  4. this.state.leagueMatchesInfo.map((league, id) => {
  5. let leagueID = league.league_id;
  6. fetch(`https://apifootball.com/api/?action=get_events&from=2017-09-11&to=2017-09-11&league_id=${leagueID}&APIkey=<APIKey>`)
  7. .then(res => res.json())
  8. .then(event => {
  9. //console.log(event)
  10. if(event.error){
  11. //console.log(event.error)
  12. }else{
  13. league.matches = true;
  14. //console.log(league)
  15. allLeagues = [...allLeagues, league]
  16. }
  17. })
  18. console.log(allLeagues)
  19.  
  20. })
  21. this.setState({
  22. leagueAL: allLeagues
  23. })
  24. }//end if(65)
  25. };//end renderItem
Add Comment
Please, Sign In to add comment