Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-05-19 13:14:43 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2fb33e5ab68258a8cdf80993fd7ad97a17f29cad
2fb33e5a
1 parent
98c12ea7
feat. get user's hub List
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
server/src/api/hub/hub.ctrl.js
server/src/api/hub/index.js
server/src/api/hub/hub.ctrl.js
View file @
2fb33e5
...
...
@@ -39,6 +39,25 @@ exports.hubConnect = async (ctx) => {
ctx
.
body
=
hub
;
};
exports
.
getHubList
=
async
(
ctx
)
=>
{
const
token
=
ctx
.
cookies
.
get
(
'access_token'
);
if
(
!
token
)
{
ctx
.
status
=
401
;
return
;
}
const
{
userId
}
=
jwt
.
verify
(
token
,
process
.
env
.
JWT_SECRET
);
const
hubList
=
await
Hub
.
find
({
userId
});
console
.
log
(
hubList
)
if
(
!
hubList
||
!
hubList
.
length
)
{
ctx
.
status
=
404
;
return
;
}
ctx
.
status
=
200
;
ctx
.
body
=
hubList
;
};
exports
.
hubDisconnect
=
async
(
ctx
)
=>
{
const
token
=
ctx
.
cookies
.
get
(
'access_token'
);
if
(
!
token
)
{
...
...
server/src/api/hub/index.js
View file @
2fb33e5
...
...
@@ -12,6 +12,14 @@ const hub = new Router();
hub
.
post
(
'/'
,
hubCtrl
.
hubConnect
);
/**
* 로그인한 유저의 허브 목록 가져오기
* request parameter : X
* url : http://localhost:4000/api/hub
* return : hub List(json type)
*/
hub
.
get
(
'/'
,
hubCtrl
.
getHubList
);
/**
* 허브 등록 해제
* request parameter : x
* url : http://localhost:4000/api/hub/:hubId
...
...
Please
register
or
login
to post a comment