-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (25 loc) · 724 Bytes
/
Copy pathscript.js
File metadata and controls
27 lines (25 loc) · 724 Bytes
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
const ui = new UI();
const user = document.getElementById("search-input");
document.getElementById("search-btn").addEventListener("click", async () => {
const userName = user.value;
if (userName !== "") {
const res = await fetch(`https://api.github.com/users/${userName}`);
const data = await res.json();
console.log(data);
getProfileDetails(data);
}
else {
}
});
function getProfileDetails(profileData) {
var profileDetails = {
mainData: profileData,
profile_pic: profileData.avatar_url,
user_name: profileData.login,
name: profileData.name,
profile_url: profileData.html_url,
message:profileData.message,
bio:profileData.bio,
};
ui.display(profileDetails);
}