-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApp.js
36 lines (31 loc) · 901 Bytes
/
App.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
/**
* Author Safnaj on 03/07/2019
* Project Github-User-Finder
**/
const github = new Github;
const ui = new UI;
//Search Input
const searchUser = document.getElementById('searchUser');
// Search input event listener
if(searchUser!=null){
searchUser.addEventListener('keyup', (e) => {
const userText = e.target.value;
if(userText !== ''){
// Make http call
github.getUser(userText).then(data => {
if(data.profile.message == 'Not Found'){
ui.showAlert('User Not Found..!' , 'alert alert-danger');
}else{
//Show Profile
ui.showProfile(data.profile);
ui.showRepos(data.repos);
}
})
}else{
//Clear Profile
ui.clearProfile();
}
});
}else{
console.log("No Response..!")
}