Last active
April 21, 2018 05:31
-
-
Save oneybee/ded1e488078cee5ed741b4919a68ecbc to your computer and use it in GitHub Desktop.
api setting_football-data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = { | |
method: 'GET', | |
headers: { | |
'X-Auth-Token': 'e600784123014d489c796ab72ed9587d' | |
}, | |
} | |
//var obj 코드는 API key가 있는 경우만 필요합니다. | |
class ExampleTwoDeepComponent extends Component { | |
constructor() { | |
super() | |
this.state = { | |
data: [], | |
} | |
} | |
componentDidMount() { | |
return fetch('http://api.football-data.org/v1/competitions/394/leagueTable',obj ) | |
//' '안에 API URL을 넣어줍니다.뒤 obj는 API key가 필요한 경우만 필요합니다. | |
.then((response) => response.json()) | |
.then((responseJson) => { | |
this.setState({ | |
data:responseJson.standing | |
// 불러온 API data에서 어떤 정보를 찾을지 지정해줍니다. | |
}) | |
console.log(this.state.data) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment