Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getLeagueMatches = () => {
- let allLeagues = []
- if(this.state.leagueMatchesInfo != null){
- this.state.leagueMatchesInfo.map((league, id) => {
- let leagueID = league.league_id;
- fetch(`https://apifootball.com/api/?action=get_events&from=2017-09-11&to=2017-09-11&league_id=${leagueID}&APIkey=<APIKey>`)
- .then(res => res.json())
- .then(event => {
- //console.log(event)
- if(event.error){
- //console.log(event.error)
- }else{
- league.matches = true;
- //console.log(league)
- allLeagues = [...allLeagues, league]
- }
- })
- console.log(allLeagues)
- })
- this.setState({
- leagueAL: allLeagues
- })
- }//end if(65)
- };//end renderItem
Add Comment
Please, Sign In to add comment