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
7fc6b37a
Commit
7fc6b37a
authored
Jan 18, 2021
by
Soo Hyun Kim
Browse files
enterChatRoom수정
parent
00dade89
Changes
5
Hide whitespace changes
Inline
Side-by-side
client/src/Components/EnterRoom.js
View file @
7fc6b37a
...
...
@@ -18,7 +18,7 @@ function EnterRoom(props) {
event
.
preventDefault
()
try
{
setError
(
''
)
//
await axios.post('/room/enterRoom', enterCode)
await
axios
.
post
(
'
/room/enterRoom
'
,
enterCode
)
props
.
enterChatRoom
(
enterCode
)
setEnterCode
(
''
)
}
catch
(
error
){
...
...
client/src/Pages/HomePage.js
View file @
7fc6b37a
...
...
@@ -70,10 +70,10 @@ function Home() {
<
Col
className
=
"
list
"
md
=
{
5
}
>
<
Tabs
defaultActiveKey
=
"
closed
"
id
=
"
uncontrolled-tab-example
"
>
<
Tab
eventKey
=
"
closed
"
title
=
"
내 채팅
"
onClick
=
{
handleChato
}
>
<
ClosedList
enterChat
r
oom
=
{
enterChatRoom
}
setRoomName
=
{
setRoomName
}
/
>
<
ClosedList
enterChat
R
oom
=
{
enterChatRoom
}
setRoomName
=
{
setRoomName
}
/
>
<
/Tab
>
<
Tab
eventKey
=
"
open
"
title
=
"
공개방
"
>
<
OpenList
enterChat
r
oom
=
{
enterChatRoom
}
setRoomName
=
{
setRoomName
}
/
>
<
OpenList
enterChat
R
oom
=
{
enterChatRoom
}
setRoomName
=
{
setRoomName
}
/
>
<
/Tab
>
<
/Tabs
>
<
/Col
>
...
...
server/controllers/roomEnter.controller.js
0 → 100644
View file @
7fc6b37a
import
Room
from
"
../models/Room.js
"
const
roomEnter
=
async
(
req
,
res
)
=>
{
const
roomId
=
req
.
body
try
{
const
room
=
await
Room
.
findOne
({
roomId
})
if
(
!
room
)
{
return
res
.
status
(
404
).
send
(
`참여코드가 존재하지 않습니다.`
)
}
// room.member =
}
catch
(
error
)
{
//알수없는 모든 에러발생시 처리
console
.
log
(
error
)
res
.
status
(
500
).
send
(
'
로그인 에러가 발생하였습니다
'
)
}
}
export
default
{
roomEnter
}
\ No newline at end of file
server/routes/roomEnter.routers.js
0 → 100644
View file @
7fc6b37a
import
express
from
'
express
'
import
roomEnterCtrl
from
'
../controllers/roomEnter.controller.js
'
const
router
=
express
.
Router
()
router
.
route
(
'
/room/enterRoom
'
)
.
post
(
roomEnterCtrl
.
roomEnter
)
export
default
router
\ No newline at end of file
server/server.js
View file @
7fc6b37a
...
...
@@ -3,6 +3,7 @@ import connectDb from './utils/connectDb.js'
import
userRouter
from
'
./routes/user.routes.js
'
import
authRouter
from
'
./routes/auth.routes.js
'
import
roomRouter
from
'
./routes/room.routers.js
'
import
roomEnterRouter
from
'
./routes/roomEnter.routers.js
'
import
bodyParser
from
"
body-parser
"
;
import
http
from
"
http
"
;
import
{
Server
}
from
'
socket.io
'
;
...
...
@@ -46,6 +47,7 @@ app.use(cors());
app
.
use
(
userRouter
)
app
.
use
(
authRouter
)
app
.
use
(
roomRouter
)
app
.
use
(
roomEnterRouter
)
server
.
listen
(
3030
,
()
=>
{
console
.
log
(
'
Listening on port 3030
'
)
...
...
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