-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (26 loc) · 688 Bytes
/
Copy pathapp.js
File metadata and controls
31 lines (26 loc) · 688 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
28
29
30
31
// init Github
const github = new Github();
// init UI
const ui = new UI();
//
// target input
const searchUser = document.getElementById("searchUser");
searchUser.addEventListener("keyup", (e) => {
// get the value from the input
const userText = e.target.value;
if (userText !== "") {
github.getUser(userText).then((data) => {
console.log('data:');
console.log(data);
if (data.profile.message === "Not Found") {
ui.showError(data.profile);
} else {
ui.showProfile(data.profile);
ui.showRepos(data.repos);
console.log(data.repos);
}
});
} else {
ui.clearProfile();
}
});