Commit 0a02c1c5 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

Merge remote-tracking branch 'origin/sooModalTest' into young

parents b21d2576 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){
......
......@@ -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 enterChatroom={enterChatroom} setRoomName={setRoomName} />
<ClosedList enterChatRoom={enterChatRoom} setRoomName={setRoomName}/>
</Tab>
<Tab eventKey="open" title="공개방" >
<OpenList enterChatroom={enterChatroom} setRoomName={setRoomName} />
<OpenList enterChatRoom={enterChatRoom} setRoomName={setRoomName}/>
</Tab>
</Tabs>
</Col>
......
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
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
......@@ -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';
......@@ -47,6 +48,7 @@ app.use('/images', express.static('uploads/'))
app.use(userRouter)
app.use(authRouter)
app.use(roomRouter)
app.use(roomEnterRouter)
server.listen(3030, () => {
console.log('Listening on port 3030')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment