Merge pull request #37 from anuraghazra/fix-name-null

fix: fallback to login if name not found
This commit is contained in:
Anurag Hazra 2020-07-13 16:15:50 +05:30 committed by GitHub
commit 8e8d7dd64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ async function fetchStats(username) {
query userInfo($login: String!) {
user(login: $login) {
name
login
repositoriesContributedTo(first: 100, contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]) {
totalCount
}
@ -50,7 +51,7 @@ async function fetchStats(username) {
const user = res.data.data.user;
stats.name = user.name;
stats.name = user.name || user.login;
stats.totalIssues = user.issues.totalCount;
stats.totalCommits = user.contributionsCollection.totalCommitContributions;
stats.totalPRs = user.pullRequests.totalCount;