JungSeungHyun

Correct remains error of Usercontroller

......@@ -108,6 +108,7 @@ dist
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
.vscode
# yarn v2
.yarn/cache
......
......@@ -2,7 +2,8 @@ const userContributionsBox = document.querySelector(".user-status__contributions
const totalContributionIndicator = document.getElementById("jsTotalContributions");
const userCharacterBox = document.querySelector(".user-status__character");
const userRepoBox = document.querySelector(".user-repo");
const URL = "https://api.github.com/users/lsj8706/repos?sort=updated&per_page=2";
const githubName = document.getElementById("jsGithubname").innerText;
const URL = `https://api.github.com/users/${githubName}/repos?sort=updated&per_page=2`;
const handleImage = () =>{
......
......@@ -28,17 +28,12 @@ export const getUserDetail = async (req, res) => {
const id = req.params.id;
const quote = await getQuote();
const user = await User.findById(id);
const repo = await getRepos();
const totalCon = await getContributions(user.githubName);
res.render("userDetail", {
pagetTitle: "User Detail",
quote: quote.quote,
author: quote.author,
user,
fitstRepoName: repo.fitstRepoName,
firstRepoUrl: repo.firstRepoUrl,
secondRepoName: repo.secondRepoName,
secondRepoUrl: repo.secondRepoUrl,
totalContributions: totalCon,
});
} catch(error){
......@@ -156,24 +151,6 @@ export const logout = (req, res) => {
res.redirect("/");
};
const getRepos = async() =>{
const url = "https://api.github.com/users/lsj8706/repos?sort=updated&per_page=2";
const latelyRepos = await axios.get(url).then(function(response){
return response.data;
});
const fitstRepoName = latelyRepos[0].name;
const secondRepoName = latelyRepos[1].name;
const firstRepoUrl = latelyRepos[0].html_url;
const secondRepoUrl = latelyRepos[1].html_url;
return {
fitstRepoName,
firstRepoUrl,
secondRepoName,
secondRepoUrl,
};
};
const getContributions = async(username) =>{
const token = process.env.GH_SECRET_SH;
const headers = {
......
......@@ -19,7 +19,7 @@ block content
h4=user.name
.user-profile__github
h3 GITHUB NICKNAME:
h4=user.githubName
h4#jsGithubname=user.githubName
.user-profile__email
h3 EMAIL:
h4=user.email
......