Reputation: 126
I'm trying to fetch an Api, but it keeps telling me there is a network error and I cant find a way anywhere to fix it.
const atlasApi = `Access-Control-Allow-Origin: https://atlas-obscura-api.herokuapp.com/api/atlas/destinations`
fetch(atlasApi).then(response => {
return response.json()
}).then(data => {
console.log(data)
})
Upvotes: 0
Views: 39
Reputation: 551
Your api url seems incorrect, please try removing Access-Control-Allow-Origin: from the atlasApi. Then it should work fine.
Upvotes: 1