-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.js
47 lines (42 loc) · 1.62 KB
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
let dataSection = document.querySelector(".cardname")
fetch( "https://api.github.com/users/akus062381" )
.then(function (response) {
return response.json()
})
.then(function (response) {
const basics = document.createElement("div")
basics.className = "basics"
basics.innerText = ("The Basics")
dataSection.appendChild(basics)
const h3El = document.createElement("div")
h3El.className = "myname"
h3El.innerText = ("Name: " + response.name)
basics.appendChild(h3El)
const url = document.createElement("a")
url.className = "linkname"
url.innerText = ("GitHub URL: " + response.url)
basics.appendChild(url)
const company = document.createElement("div")
company.className = "company"
company.innerText = ("Company: " + response.company)
basics.appendChild(company)
const website = document.createElement("div")
website.className = "website"
website.innerText = ("Website: " + response.blog)
basics.appendChild(website)
const story = document.createElement("div")
story.className = "story"
story.innerText = ("The Story")
dataSection.appendChild(story)
const bio = document.createElement("div")
bio.className = "bio"
bio.innerText = response.bio
story.appendChild(bio)
createImageSection(response)
})
function createImageSection (response) {
const avatar = new Image
avatar.className = "avatar"
avatar.src = response.avatar_url
dataSection.appendChild(avatar)
}