diff --git a/index.js b/index.js index 1084ed8..f8c9f18 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,22 @@ function getIssues() { + fetch('javascript-fetch-lab/issues', { + headers: { + Authorization: `token ${token}` + } + }).then(res => res.json()).then(json => console.log(json)); } function showIssues(json) { } function createIssue() { + fetch('javascript-fetch-lab/issues', { + method: 'post', + body: 'test body', + headers: { + Authorization: `token ${token}` + } + }).then(res => res.json()).then(json => console.log(json)); } function showResults(json) { @@ -12,7 +24,12 @@ function showResults(json) { function forkRepo() { const repo = 'learn-co-curriculum/javascript-fetch-lab' - //use fetch to fork it! + fetch('/api.github.com/repos/' + repo, { + method: 'post', + headers: { + Authorization: `token ${token}` + } + }).then(res => res.json()).then(json => console.log(json)); } function getToken() { @@ -20,3 +37,5 @@ function getToken() { //back to '' before committing so all tests pass return '' } + +const token = getToken();