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
b5bbe457
Commit
b5bbe457
authored
Jan 20, 2021
by
Choi Ga Young
Browse files
Merge remote-tracking branch 'origin/sooModalTest' into young
parents
eacfbbbf
a176c47f
Changes
4
Show whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
b5bbe457
...
...
@@ -6,12 +6,11 @@ function Chat(props) {
let
defaultname
=
sessionStorage
.
getItem
(
'
name
'
);
const
[
inner
,
setInner
]
=
useState
([
''
])
const
[
chat
,
setChat
]
=
useState
([
inner
])
//object로 key는 보낸사람 value는 메세지
const
[
chat
,
setChat
]
=
useState
([])
//object로 key는 보낸사람 value는 메세지
function
handleChange
(
e
)
{
e
.
preventDefault
()
setInner
(
e
.
target
.
value
)
console
.
log
(
e
.
target
.
value
)
}
function
sendMsgCH
(
e
)
{
...
...
client/src/Components/EnterRoom.js
View file @
b5bbe457
...
...
@@ -18,8 +18,11 @@ function EnterRoom(props) {
event
.
preventDefault
()
try
{
setError
(
''
)
await
axios
.
post
(
'
/room/enterRoom
'
,
enterCode
)
let
res
=
await
axios
.
post
(
'
/room/enterRoom
'
,
{
enterCode
})
props
.
setRoomName
(
res
.
data
)
props
.
enterChatRoom
(
enterCode
)
props
.
handleCloseEnter
()
props
.
handleChato
()
setEnterCode
(
''
)
}
catch
(
error
){
catchErrors
(
error
,
setError
)
...
...
client/src/Pages/HomePage.js
View file @
b5bbe457
...
...
@@ -24,6 +24,8 @@ function Home() {
//방참가
const
[
roomName
,
setRoomName
]
=
useState
(
''
)
const
handleCloseModal
=
()
=>
setShowModal
(
false
);
const
handleShowModal
=
()
=>
setShowModal
(
true
);
const
handleCloseEnter
=
()
=>
setEnter
(
false
);
...
...
@@ -90,7 +92,7 @@ function Home() {
<
/Col
>
<
/Row
>
<
RoomMake
showModal
=
{
showModal
}
handleCloseModal
=
{
handleCloseModal
}
/
>
<
EnterRoom
showEnter
=
{
showEnter
}
enterChatRoom
=
{
enterChatRoom
}
handleCloseEnter
=
{
handleCloseEnter
}
/
>
<
EnterRoom
showEnter
=
{
showEnter
}
enterChatRoom
=
{
enterChatRoom
}
handleCloseEnter
=
{
handleCloseEnter
}
handleChato
=
{
handleChato
}
setRoomName
=
{
setRoomName
}
/
>
<
/
>
);
}
...
...
server/controllers/roomEnter.controller.js
View file @
b5bbe457
import
Room
from
"
../models/Room.js
"
const
roomEnter
=
async
(
req
,
res
)
=>
{
const
roomId
=
req
.
body
const
roomId
=
req
.
body
.
enterCode
// console.log(req)
try
{
console
.
log
(
roomId
)
const
room
=
await
Room
.
findOne
({
roomId
})
if
(
!
room
)
{
return
res
.
status
(
404
).
send
(
`참여코드가 존재하지 않습니다.`
)
}
// room.member =
console
.
log
(
'
roomId존재
'
)
const
name
=
await
Room
.
findOne
({
roomId
:
roomId
}).
select
(
'
roomName
'
)
return
res
.
json
(
name
.
roomName
)
}
catch
(
error
)
{
//알수없는 모든 에러발생시 처리
console
.
log
(
error
)
res
.
status
(
500
).
send
(
'
로그인 에러가 발생하였습니다
'
)
res
.
status
(
500
).
send
(
'
방 참여 에러
'
)
}
}
export
default
{
roomEnter
}
\ 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