Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
messenger
Commits
9cb335c0
Commit
9cb335c0
authored
Jan 18, 2021
by
우지원
Browse files
Merge remote-tracking branch 'origin/young' into jiweon827
parents
48536fea
80a6069e
Changes
4
Hide whitespace changes
Inline
Side-by-side
client/src/Components/ClosedList.js
View file @
9cb335c0
...
@@ -3,6 +3,7 @@ import { ListGroup, Row, Col } from 'react-bootstrap';
...
@@ -3,6 +3,7 @@ import { ListGroup, Row, Col } from 'react-bootstrap';
import
axios
from
'
axios
'
import
axios
from
'
axios
'
function
ClosedList
(
props
)
{
function
ClosedList
(
props
)
{
const
[
list
,
setList
]
=
useState
([]);
const
[
list
,
setList
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -12,7 +13,9 @@ function ClosedList(props) {
...
@@ -12,7 +13,9 @@ function ClosedList(props) {
const
userId
=
sessionStorage
.
getItem
(
'
userId
'
);
const
userId
=
sessionStorage
.
getItem
(
'
userId
'
);
async
function
getClosedList
()
{
async
function
getClosedList
()
{
let
res
=
await
axios
.
get
(
'
/room/closedlist
'
)
const
userid
=
sessionStorage
.
getItem
(
'
userId
'
)
console
.
log
(
'
id가져오기
'
,
userid
)
let
res
=
await
axios
.
get
(
'
/room/closedlist
'
,
{
params
:
{
'
_id
'
:
userid
}
})
console
.
log
(
'
가져온거
'
,
res
)
console
.
log
(
'
가져온거
'
,
res
)
setList
(
res
.
data
)
setList
(
res
.
data
)
}
}
...
...
client/src/Components/OpenList.js
View file @
9cb335c0
import
axios
from
'
axios
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
import
React
,
{
useEffect
,
useState
}
from
'
react
'
import
{
ListGroup
}
from
'
react-bootstrap
'
;
import
{
ListGroup
}
from
'
react-bootstrap
'
;
import
axios
from
'
axios
'
function
OpenList
(
props
)
{
function
OpenList
(
props
)
{
const
[
list
,
setList
]
=
useState
([]);
const
[
list
,
setList
]
=
useState
([]);
...
@@ -10,11 +10,12 @@ function OpenList(props) {
...
@@ -10,11 +10,12 @@ function OpenList(props) {
},
[]);
},
[]);
async
function
getOpenList
()
{
async
function
getOpenList
()
{
let
res
=
await
axios
.
get
(
'
/room/
O
penlist
'
)
let
res
=
await
axios
.
get
(
'
/room/
o
penlist
'
)
console
.
log
(
'
가져온거
'
,
res
)
console
.
log
(
'
가져온거
'
,
res
)
setList
(
res
.
data
)
setList
(
res
.
data
)
}
}
function
enterChatroomCH
(
e
)
{
function
enterChatroomCH
(
e
)
{
console
.
log
(
e
.
target
.
name
)
console
.
log
(
e
.
target
.
name
)
console
.
log
(
e
.
target
)
console
.
log
(
e
.
target
)
...
@@ -30,8 +31,8 @@ function OpenList(props) {
...
@@ -30,8 +31,8 @@ function OpenList(props) {
<
div
>
<
div
>
{
list
.
map
((
item
,
index
)
=>
{
list
.
map
((
item
,
index
)
=>
<
ListGroup
key
=
{
index
}
>
<
ListGroup
key
=
{
index
}
>
<
ListGroup
.
Item
action
onClick
=
{
enterChatroomCH
}
name
=
{
item
.
roomName
}
>
<
ListGroup
.
Item
action
onClick
=
{
enterChatroomCH
}
name
=
{
list
.
roomName
}
>
{
item
.
roomName
}
{
list
.
roomName
}
<
/ListGroup.Item
>
<
/ListGroup.Item
>
<
/ListGroup
>
<
/ListGroup
>
)}
)}
...
...
server/controllers/room.controller.js
View file @
9cb335c0
...
@@ -40,19 +40,21 @@ const makeRoom = async (req, res) => {
...
@@ -40,19 +40,21 @@ const makeRoom = async (req, res) => {
const
getClosedList
=
async
(
req
,
res
)
=>
{
const
getClosedList
=
async
(
req
,
res
)
=>
{
try
{
try
{
let
list
=
await
Room
.
find
({
isOpen
:
false
})
console
.
log
(
'
req확인
'
,
req
.
query
.
_id
)
console
.
log
({
userId
})
let
list
=
await
Room
.
find
({
moderator
console
.
log
(
'
list가져오기
'
,
list
)
:
req
.
query
.
_id
})
console
.
log
(
'
c_list가져오기
'
,
list
)
return
res
.
json
(
list
)
return
res
.
json
(
list
)
}
catch
(
error
)
{
}
catch
(
error
)
{
res
.
status
(
500
).
send
(
'
리스트 불러오기를 실패하였습니다!
'
)
res
.
status
(
500
).
send
(
'
리스트 불러오기를 실패하였습니다!
'
)
}
}
}
}
const
getOpenList
=
async
(
req
,
res
)
=>
{
const
getOpenList
=
async
(
req
,
res
)
=>
{
try
{
try
{
let
list
=
await
Room
.
find
({
isOpen
:
true
})
let
list
=
await
Room
.
find
({
isOpen
:
true
})
console
.
log
(
'
list가져오기
'
,
list
)
console
.
log
(
'
o_
list가져오기
'
,
list
)
return
res
.
json
(
list
)
return
res
.
json
(
list
)
}
catch
(
error
)
{
}
catch
(
error
)
{
res
.
status
(
500
).
send
(
'
리스트 불러오기를 실패하였습니다!
'
)
res
.
status
(
500
).
send
(
'
리스트 불러오기를 실패하였습니다!
'
)
...
...
server/routes/room.routers.js
View file @
9cb335c0
...
@@ -11,5 +11,4 @@ router.route('/room/closedlist')
...
@@ -11,5 +11,4 @@ router.route('/room/closedlist')
router
.
route
(
'
/room/openlist
'
)
router
.
route
(
'
/room/openlist
'
)
.
get
(
roomCtrl
.
getOpenList
)
.
get
(
roomCtrl
.
getOpenList
)
export
default
router
export
default
router
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment