From bbd64b0d3bcff292cbb8694025d4c388e1dc200f Mon Sep 17 00:00:00 2001 From: John Tuttle Date: Thu, 14 Dec 2017 16:39:34 +0000 Subject: [PATCH 1/2] Done. --- index.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 1084ed8..04bb223 100644 --- a/index.js +++ b/index.js @@ -1,22 +1,49 @@ +const token = '17726abac5af7f865391974e3e8702b40b5cdbf0' + function getIssues() { + const repo = 'https:/api.github.com\/repos\/eltuttle\/javascript-fetch-lab\/issues' + fetch(repo, { + headers: { + Authorization: `token ${token}` + } + }).then(res => console.log(res)) } function showIssues(json) { } function createIssue() { + var title = document.getElementById('title').value + var body = document.getElementById('body').value + const postData = { + title: title, + body: body + }; + const repo = 'https:/api.github.com\/repos\/eltuttle\/javascript-fetch-lab\/issues' + fetch(repo, { + method: 'post', + body: JSON.stringify(postData), + headers: { + Authorization: `token ${token}` + } + }).then(res => console.log(res))//.then(json => console.log(json)); } function showResults(json) { } function forkRepo() { - const repo = 'learn-co-curriculum/javascript-fetch-lab' - //use fetch to fork it! + const repo = 'https:/api.github.com\/repos\/learn-co-curriculum\/javascript-fetch-lab/forks' + fetch(repo, { + method: 'post', + headers: { + Authorization: `token ${token}` + } + }).then(res => res.json()).then(json => console.log(json)); } function getToken() { //change to your token to run in browser, but set //back to '' before committing so all tests pass - return '' + return ''; } From d9b04b224473e947beb847f7d1eb1c5a6d3d5b06 Mon Sep 17 00:00:00 2001 From: John Tuttle Date: Thu, 14 Dec 2017 16:39:56 +0000 Subject: [PATCH 2/2] Done. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 04bb223..10e7b08 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -const token = '17726abac5af7f865391974e3e8702b40b5cdbf0' +const token = '' function getIssues() { const repo = 'https:/api.github.com\/repos\/eltuttle\/javascript-fetch-lab\/issues'