-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
65 lines (52 loc) · 2.04 KB
/
index.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
48
49
50
51
52
53
54
55
56
57
58
59
60
function getUser() {
var user = document.getElementById('u_name').value;
fetch(`https://api.github.com/users/` + user)
.then(response => response.json())
.then(data => {
var name = data.login;
var bio = data.bio;
var blog = data.blog;
var email = data.email;
var twitter = data.twitter_username;
var repos = data.public_repos;
var img_route = data.avatar_url;
console.log(name) // Prints result from `response.json()` in getRequest
console.log(bio)
console.log(blog)
console.log(email)
console.log(twitter)
console.log(repos)
document.getElementById('login').innerHTML = name;
document.getElementById('Repositorios').innerHTML = repos;
document.getElementById('Bio').innerHTML = bio;
document.getElementById('Blog').innerHTML = blog;
document.getElementById('Email').innerHTML = email;
document.getElementById('Twitter').innerHTML = twitter;
document.getElementById('user_pic').src = img_route;
})
.catch(error => console.error(error));
}
fetch(`https://api.github.com/users/` + user)
.then(response => response.json())
.then(data => {
var name = data.login;
var bio = data.bio;
var blog = data.blog;
var email = data.email;
var twitter = data.twitter_username;
var repos = data.public_repos;
console.log(name) // Prints result from `response.json()` in getRequest
console.log(bio)
console.log(blog)
console.log(email)
console.log(twitter)
console.log(repos)
document.getElementById('login').innerHTML = name;
document.getElementById('Repositorios').innerHTML = repos;
document.getElementById('Bio').innerHTML = bio;
document.getElementById('Blog').innerHTML = blog;
document.getElementById('Email').innerHTML = email;
document.getElementById('Twitter').innerHTML = twitter;
})
.catch(error => console.error(error));
//completar peticion y mostrar cantidad de repos en html así como la cantidad de repos de javascript