Commit ddf82690 authored by 우지원's avatar 우지원
Browse files

e

parent 1e39e798
......@@ -3,7 +3,7 @@ import { ListGroup } from 'react-bootstrap';
import axios from 'axios'
function OpenList(props) {
const [list, setList] = useState([]);
const [openlist, setOpenlist] = useState([]);
useEffect(() => {
getOpenList();
......@@ -12,7 +12,7 @@ function OpenList(props) {
async function getOpenList() {
let res = await axios.get('/room/openlist')
console.log('가져온거', res)
setList(res.data)
setOpenlist(res.data)
}
......@@ -29,10 +29,10 @@ function OpenList(props) {
return (
<div>
{list.map((item, index) =>
{openlist.map((item, index) =>
<ListGroup key={index}>
<ListGroup.Item action onClick={enterChatroomCH} name={list.roomName}>
{list.roomName}
<ListGroup.Item action onClick={enterChatroomCH} name={item.roomName}>
{item.roomName}
</ListGroup.Item>
</ListGroup>
)}
......
......@@ -37,7 +37,6 @@ function Home() {
const handleClose2 = () => setShow2(false);
const handleShow2 = () => setShow2(true);
const moderator = sessionStorage.getItem('userId');
const member = sessionStorage.getItem('userId');
useEffect(() => {
......@@ -47,7 +46,7 @@ function Home() {
function handleChange(event) {
const { name, value } = event.target
setRoom({ ...room, [name]: value, moderator, member })
setRoom({ ...room, [name]: value, member })
//console.log(room)
}
......
......@@ -6,8 +6,8 @@ const nanoid = customAlphabet('1234567890abcdef', 10)
const makeRoom = async (req, res) => {
console.log(req.body)
const { roomName, interest, isOpen, moderator, member } = req.body;
console.log(roomName, interest, isOpen, moderator, member)
const { roomName, interest, isOpen, member } = req.body;
console.log(roomName, interest, isOpen, member)
const roomId = nanoid()
const room = await Room.findOne({ roomId })
......@@ -27,7 +27,6 @@ const makeRoom = async (req, res) => {
roomName,
interest,
isOpen,
moderator,
member,
}).save()
console.log(newRoom)
......
......@@ -22,10 +22,6 @@ const RoomSchema = new mongoose.Schema({
type: Boolean,
required: true,
},
moderator: {
type: String,
required: true,
},
member: {
type: Array,
required: true,
......
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