-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
33 lines (28 loc) · 858 Bytes
/
main.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
const socialMediaData = {
github: 'dam450',
youtube: 'user/D3v14nz',
facebook: '',
instagram: 'ev4nd7o',
twitter: 'ev4nd7o'
}
function changeSocialMediaLinks() {
for (let li of socialLinks.children) {
const social = li.getAttribute('class')
li.children[0].href = `https://www.${social}.com/${socialMediaData[social]}`
}
}
function getGithubUserData(user) {
const url = `https://api.github.com/users/${user}`
fetch(url)
.then(response => response.json())
.then(data => {
userName.textContent = data.name
gitUserName.textContent = data.login
gitBio.textContent = data.bio
gitLink.href = data.html_url
photo.src = data.avatar_url
document.title = `${data.name} - DoWhile 2021`
})
}
changeSocialMediaLinks()
getGithubUserData(socialMediaData.github)