Showing
4 changed files
with
4 additions
and
25 deletions
... | @@ -108,6 +108,7 @@ dist | ... | @@ -108,6 +108,7 @@ dist |
108 | 108 | ||
109 | # Stores VSCode versions used for testing VSCode extensions | 109 | # Stores VSCode versions used for testing VSCode extensions |
110 | .vscode-test | 110 | .vscode-test |
111 | +.vscode | ||
111 | 112 | ||
112 | # yarn v2 | 113 | # yarn v2 |
113 | .yarn/cache | 114 | .yarn/cache | ... | ... |
... | @@ -2,7 +2,8 @@ const userContributionsBox = document.querySelector(".user-status__contributions | ... | @@ -2,7 +2,8 @@ const userContributionsBox = document.querySelector(".user-status__contributions |
2 | const totalContributionIndicator = document.getElementById("jsTotalContributions"); | 2 | const totalContributionIndicator = document.getElementById("jsTotalContributions"); |
3 | const userCharacterBox = document.querySelector(".user-status__character"); | 3 | const userCharacterBox = document.querySelector(".user-status__character"); |
4 | const userRepoBox = document.querySelector(".user-repo"); | 4 | const userRepoBox = document.querySelector(".user-repo"); |
5 | -const URL = "https://api.github.com/users/lsj8706/repos?sort=updated&per_page=2"; | 5 | +const githubName = document.getElementById("jsGithubname").innerText; |
6 | +const URL = `https://api.github.com/users/${githubName}/repos?sort=updated&per_page=2`; | ||
6 | 7 | ||
7 | 8 | ||
8 | const handleImage = () =>{ | 9 | const handleImage = () =>{ | ... | ... |
... | @@ -28,17 +28,12 @@ export const getUserDetail = async (req, res) => { | ... | @@ -28,17 +28,12 @@ export const getUserDetail = async (req, res) => { |
28 | const id = req.params.id; | 28 | const id = req.params.id; |
29 | const quote = await getQuote(); | 29 | const quote = await getQuote(); |
30 | const user = await User.findById(id); | 30 | const user = await User.findById(id); |
31 | - const repo = await getRepos(); | ||
32 | const totalCon = await getContributions(user.githubName); | 31 | const totalCon = await getContributions(user.githubName); |
33 | res.render("userDetail", { | 32 | res.render("userDetail", { |
34 | pagetTitle: "User Detail", | 33 | pagetTitle: "User Detail", |
35 | quote: quote.quote, | 34 | quote: quote.quote, |
36 | author: quote.author, | 35 | author: quote.author, |
37 | user, | 36 | user, |
38 | - fitstRepoName: repo.fitstRepoName, | ||
39 | - firstRepoUrl: repo.firstRepoUrl, | ||
40 | - secondRepoName: repo.secondRepoName, | ||
41 | - secondRepoUrl: repo.secondRepoUrl, | ||
42 | totalContributions: totalCon, | 37 | totalContributions: totalCon, |
43 | }); | 38 | }); |
44 | } catch(error){ | 39 | } catch(error){ |
... | @@ -156,24 +151,6 @@ export const logout = (req, res) => { | ... | @@ -156,24 +151,6 @@ export const logout = (req, res) => { |
156 | res.redirect("/"); | 151 | res.redirect("/"); |
157 | }; | 152 | }; |
158 | 153 | ||
159 | -const getRepos = async() =>{ | ||
160 | - const url = "https://api.github.com/users/lsj8706/repos?sort=updated&per_page=2"; | ||
161 | - const latelyRepos = await axios.get(url).then(function(response){ | ||
162 | - return response.data; | ||
163 | - }); | ||
164 | - const fitstRepoName = latelyRepos[0].name; | ||
165 | - const secondRepoName = latelyRepos[1].name; | ||
166 | - const firstRepoUrl = latelyRepos[0].html_url; | ||
167 | - const secondRepoUrl = latelyRepos[1].html_url; | ||
168 | - | ||
169 | - return { | ||
170 | - fitstRepoName, | ||
171 | - firstRepoUrl, | ||
172 | - secondRepoName, | ||
173 | - secondRepoUrl, | ||
174 | - }; | ||
175 | -}; | ||
176 | - | ||
177 | const getContributions = async(username) =>{ | 154 | const getContributions = async(username) =>{ |
178 | const token = process.env.GH_SECRET_SH; | 155 | const token = process.env.GH_SECRET_SH; |
179 | const headers = { | 156 | const headers = { | ... | ... |
... | @@ -19,7 +19,7 @@ block content | ... | @@ -19,7 +19,7 @@ block content |
19 | h4=user.name | 19 | h4=user.name |
20 | .user-profile__github | 20 | .user-profile__github |
21 | h3 GITHUB NICKNAME: | 21 | h3 GITHUB NICKNAME: |
22 | - h4=user.githubName | 22 | + h4#jsGithubname=user.githubName |
23 | .user-profile__email | 23 | .user-profile__email |
24 | h3 EMAIL: | 24 | h3 EMAIL: |
25 | h4=user.email | 25 | h4=user.email | ... | ... |
-
Please register or login to post a comment