Skip to content

Commit c607987

Browse files
fetched all repositories
1 parent ded93a5 commit c607987

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

code/index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44
<meta charset="UTF-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Project GitHub Tracker</title>
7+
<title>GitHub Tracker</title>
88
<link rel="stylesheet" href="./style.css" />
99
</head>
10+
1011
<body>
1112
<h1>GitHub Tracker</h1>
1213
<h2>Projects:</h2>
13-
<main id="projects"></main>
14+
<main id="projects">
15+
<div id="container" class="container">
16+
</div>
17+
</main>
1418

1519
<!-- This will be used to draw the chart 👇 -->
1620
<canvas id="chart"></canvas>
1721

1822
<script src="./script.js"></script>
1923
<script src="./chart.js"></script>
2024
</body>
25+
2126
</html>

code/script.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const username = 'mathildakarlsson'
2+
let reponame = ''
3+
4+
5+
//Fetch 1
6+
const API_URL = `https://api.github.com/users/${username}/repos`
7+
8+
fetch(API_URL)
9+
.then(res => res.json())
10+
.then(data => {
11+
console.log(data)
12+
reponame = data[3].name
13+
14+
data.forEach(repo => {
15+
document.getElementById('container').innerHTML += `
16+
<div class="repo">
17+
<h4>${repo.name}</h4>
18+
</div>
19+
`
20+
})
21+
22+
23+
24+
25+
//Fetch 2
26+
const API_URL_PR = `https://api.github.com/repos/Technigo/${reponame}/pulls`
27+
28+
fetch(API_URL_PR)
29+
.then(res => res.json())
30+
.then(data => {
31+
console.log(data)
32+
})
33+
})

code/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
body {
22
background: #FFECE9;
3+
}
4+
5+
.container {
6+
display: grid;
7+
grid-template-columns: 2fr(1);
38
}

0 commit comments

Comments
 (0)