Last active
September 23, 2017 20:58
-
-
Save alundiak/1e39a01059d61bd33d21c316a2bf4ef9 to your computer and use it in GitHub Desktop.
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
const apiUrl = 'https://api.github.com'; | |
export default function getInfo(TOKEN, myArrayOfRepositories) { | |
myArrayOfRepositories.forEach(function(repository) { | |
let strUrl = apiUrl + '/repos/' + repository.owner + '/' + repository.name; | |
let options = { | |
headers: { | |
// 'Content-Type': 'application/json', // OPTIONS => GET | |
// 'Content-Type': 'text/plain', // doesn't matter. Anyway OPTIONS => GET | |
'Authorization': `token ${TOKEN}` | |
} | |
} | |
fetch(strUrl, options) | |
.then(response => response.json()) | |
.then(data => console.log(data)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment