@@ -15,24 +15,66 @@ fetch(url)
1515 const game_data = data . games ;
1616 return game_data . map ( ( game ) => {
1717
18+ console . log ( game ) ;
1819 let game_container = createNode ( 'div' )
19- let home_team = createNode ( 'h3' )
20- let away_team = createNode ( 'h3' )
20+ let home_team = createNode ( 'div' )
21+ let home_score = createNode ( 'p' )
22+ let away_team = createNode ( 'div' )
23+ let away_score = createNode ( 'p' )
24+
2125
2226 game_container . classList . add ( 'game' ) ;
2327 home_team . classList . add ( 'team' ) ;
2428 away_team . classList . add ( 'team' ) ;
2529
2630 home_team . innerHTML = `${ game . home_team_city } ${ game . home_team_name } `
31+ home_score . innerHTML = `${ game . linescore . r . home } `
32+ console . log ( game . linescore . r . home ) ;
33+ away_score . innerHTML = `${ game . linescore . r . away } `
2734 away_team . innerHTML = `${ game . away_team_city } ${ game . away_team_name } `
2835
2936 append ( game_container , home_team ) ;
37+ append ( home_team , home_score ) ;
3038 append ( game_container , away_team ) ;
39+ append ( away_team , away_score ) ;
3140 append ( games , game_container ) ;
3241 } )
3342 } )
3443 . catch ( ( err ) => {
3544 console . log ( err )
3645 } ) ;
3746
38- console . log ( "LOADED" ) ;
47+ console . log ( "LOADED" ) ;
48+
49+ // //const url = 'https://randomuser.me/api';
50+ // // The data we are going to send in our request
51+ // let data = {
52+ // name: 'Sara'
53+ // }
54+ // // The parameters we are gonna pass to the fetch function
55+ // let fetchData = {
56+ // method: 'POST',
57+ // body: data,
58+ // headers: new Headers()
59+ // }
60+ // fetch(url, fetchData)
61+ // .then(function() {
62+ // // Handle response you get from the server
63+ // });
64+
65+ // const url = 'https://randomuser.me/api';
66+ // // The data we are going to send in our request
67+ // let data = {
68+ // name: 'Sara'
69+ // }
70+ // // Create our request constructor with all the parameters we need
71+ // var request = new Request(url, {
72+ // method: 'POST',
73+ // body: data,
74+ // headers: new Headers()
75+ // });
76+
77+ // fetch(request)
78+ // .then(function() {
79+ // // Handle response we get from the API
80+ // })
0 commit comments