Skip to content

Commit 1c9c4cf

Browse files
committed
removed null display bug when user name or bio was not found in github-profiles project
1 parent 0cb9fd3 commit 1c9c4cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

github-profiles/script.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ async function getRepos(username) {
2828
}
2929

3030
function createUserCard(user) {
31+
const userID = user.name || user.login
32+
const userBio = user.bio ? `<p>${user.bio}</p>` : ''
3133
const cardHTML = `
3234
<div class="card">
3335
<div>
3436
<img src="${user.avatar_url}" alt="${user.name}" class="avatar">
3537
</div>
3638
<div class="user-info">
37-
<h2>${user.name}</h2>
38-
<p>${user.bio}</p>
39+
<h2>${userID}</h2>
40+
${userBio}
3941
<ul>
4042
<li>${user.followers} <strong>Followers</strong></li>
4143
<li>${user.following} <strong>Following</strong></li>

0 commit comments

Comments
 (0)