Skip to content

Commit

Permalink
removing get github users external data
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelernestog committed Apr 6, 2023
1 parent e514b4d commit 050b0fa
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/helpers/generateMemberEndpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function generateMemberEndpoint(githubMemberData) {
avatar_url_small: "https://avatars.githubusercontent.com/u/" + githubMemberData.id + "?s=64&v=4",
avatar_url_medium: "https://avatars.githubusercontent.com/u/" + githubMemberData.id + "?s=128&v=4",
github_url: "https://github.com/" + githubMemberData.login,
categories: []
categories: [],
};
let data = await getRemoteFileData(
`https://raw.githubusercontent.com/${githubMemberData.login}/${githubMemberData.login}/main/cucoders_data/profile-data.json`,
Expand All @@ -33,34 +33,7 @@ async function generateMemberEndpoint(githubMemberData) {
profileData.categories = data.categories;
profileData.telegram_username = data.telegram_username;
profileData.linkedin_username = data.linkedin_username;
} else {
profileData = await getGitHubUserData(profileData);
}

return profileData;
}

async function getGitHubUserData(profileData) {
const url = backend_url + "api/members/get-member?username=" + profileData.username;

const respose = await fetch(url, { method: "GET" });
const data = await respose.json();

if (!data) {
return profileData;
}

if (data.name) {
profileData.name = data.name;
}
profileData.company = data.company;
profileData.web = data.blog;
profileData.location = data.location;
profileData.email = data.email;
profileData.hireable = data.hireable;
profileData.bio = data.bio;
profileData.twitter_username = data.twitter_username;

return profileData;
}

Expand Down

0 comments on commit 050b0fa

Please sign in to comment.