Problem: Fetch in React for Leaderboard [SOLVED]

Trying to grab the info off of https://fcctop100.herokuapp.com/api/fccusers/top/recent

by using

	<script type="text/babel">

fetch("https://fcctop100.herokuapp.com/api/fccusers/top/recent")
	.then(
		function(response) {
			console.log(response)
		}
	)

</script>	

but it is returning

Response {type: "cors", url: "https://fcctop100.herokuapp.com/api/fccusers/top/recent", redirected: false, status: 200, ok: true…}

I tried this for several endpoints and the result is always 200 - any way I can use fetch for this or do I have to request the data in another way?

1 Like

200 is good

The response data is accessed with response.json()

fetch("https://fcctop100.herokuapp.com/api/fccusers/top/recent")
	.then(function(response) {return response.json()})
	.then(data => console.log(data))
2 Likes

lol, to my tired mind it was an error code - thank you :slight_smile: