Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이세진
/
dev-profile
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
10
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
JungSeungHyun
2021-06-07 23:31:19 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3dd97787bdb67559e6cc61cb60fb395606d3d6d5
3dd97787
1 parent
98b80a45
Correct remains error of Usercontroller
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
25 deletions
.gitignore
src/client/js/githubInfo.js
src/controllers/userController.js
src/views/userDetail.pug
.gitignore
View file @
3dd9778
...
...
@@ -108,6 +108,7 @@ dist
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
.vscode
# yarn v2
.yarn/cache
...
...
src/client/js/githubInfo.js
View file @
3dd9778
...
...
@@ -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
=
()
=>
{
...
...
src/controllers/userController.js
View file @
3dd9778
...
...
@@ -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
=
{
...
...
src/views/userDetail.pug
View file @
3dd9778
...
...
@@ -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
...
...
Please
register
or
login
to post a comment