My code has an api key in it that I don’t want to put up on codepen. I wanted to replace that one with this version of the api. When I pulled out the ajax function it didn’t work. I broke it down to the most basic components, above, and it still didn’t work. I tested the endpoint with a real user in curl, and it did work though.
I guess I get that U want to help me debug my project, but I am literally not able to get the wind-bow to return a response.
Below does work, and this what I wanted to change up kraken for wind-bow. Not that it means much, but maybe this will help you understand what I am trying to do, and why (to get rid of the need for the api key)
function makeAjax(url, arr, callback){
let results = [];
arr.forEach((i) => {
let myHeaders = new Headers();
myHeaders.append('Client-ID','19999999999999999-xxxxxxxxxxxx')
let options = {
method: 'GET',
headers: myHeaders,
}
fetch(`${url}/${i}`,options)
.then(blob => blob.json ())
.then((data) => { results.push(data)})
})
// returns an array
setTimeout(function(){
callback(results)
},1000)
}
makeAjax(`https://api.twitch.tv/kraken/channels/`, users,(res) => { console.log(res)})