Commit 7a5a52a5 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

불필요한거 삭제

parent 9d342b6c
import React, { useState, useEffect } from 'react'
import React from 'react'
import { Badge, ListGroup } from 'react-bootstrap';
import axios from 'axios'
const INIT_LIST = [{
interest: '',
......
......@@ -23,7 +23,6 @@ function EnterRoom(props) {
let res = await axios.post('/room/enterRoom', { enterCode })
await axios.put('/room/member', { userId: userId, roomId: enterCode })
const response = await axios.get('/users/check', { params: { '_id': userId } })
// console.log('res확인22', response.data.nickname)
const userNick = response.data.nickname;
props.setRoomName(res.data)
props.setRoomCode(enterCode)
......
import React, { useState, useEffect } from 'react'
import React from 'react'
import { ListGroup } from 'react-bootstrap';
import axios from 'axios'
function OpenList(props) {
......
import React, { useState, useEffect } from 'react';
import axios from 'axios'
import { Button, Form, Container, Navbar, Spinner, Alert } from 'react-bootstrap';
import { Button, Form, Container, Spinner, Alert } from 'react-bootstrap';
import catchErrors from '../utils/catchErrors'
import { Link, Redirect } from 'react-router-dom'
import { Redirect } from 'react-router-dom'
import { handleLogin } from '../utils/auth'
import Menu from '../Components/Menu';
......
import React, { useState, useEffect } from 'react';
import axios from 'axios'
import { Button, Form, Container, Alert, Navbar } from 'react-bootstrap';
import { Button, Form, Container, Alert } from 'react-bootstrap';
import catchErrors from '../utils/catchErrors';
import { Redirect } from 'react-router-dom';
import Menu from '../Components/Menu';
......@@ -32,16 +32,6 @@ function SingUp() {
async function handleSubmit(event) {
event.preventDefault();
//빈문자열 입력 시 오류 문자 출력
//const form = event.currentTarget;
//if (form.checkValidity() === false) {
// event.preventDefault();
// event.stopPropagation();
// //event.stopPropagation() : 이벤트 캡쳐링과 버블링에 있어 현재 이벤트 이후의 전파를 막습니다.
//}
//setValidated(true);
// console.log(user)
try {
setError('')
await axios.post('/users/signup', user)
......@@ -57,11 +47,9 @@ function SingUp() {
return <Redirect to='/login' />
}
return (
<>
<Menu />
<Form onSubmit={handleSubmit} className='vh-100 flex-column align-items-center justify-content-center mt-2'>
<Container className="d-flex justify-content-center">
<div className="mt-5 p-5 shadow w-75">
......
import Room from "../models/Room.js"
import { customAlphabet } from 'nanoid'
import isLength from 'validator/lib/isLength.js'
//import AccessInfo from '../models/AccessInfo.js'
import Chat from "../models/Chat.js"
const nanoid = customAlphabet('1234567890abcdef', 10)
......@@ -69,25 +68,6 @@ const getRoomName = async (req, res) => {
}
}
// const sysMsg = async (req, res) => {
// try {
// console.log('sysreq', req.query)
// let rmif = await Room.find({ roomId: req.query.roomCode })
// console.log('rmif', rmif)
// let rmid = await AccessInfo.find({ room: rmif._id })
// console.log('rmid', rmid)
// if (rmid.isEnt) {
// let msg = `${rmif.nickname}이 들어왔습니다`
// } else {
// }
// } catch (error) {
// res.status(500).send('')
// }
// }
const changemember = async (req, res) => {
const { userId, roomId } = req.body
console.log(roomId)
......@@ -127,7 +107,6 @@ const deleteUserId = async (req, res) => {
const roomInf = async (req, res) => {
try {
console.log(req.query.roomId)
// let roomInf = await Room.findOne({ member: req.query.roomId }).select('interest roomId member').exec()
let roomInf = await Room.find({ roomId: req.query.roomId })
console.log('room_member로 정보 가져오기:', roomInf)
return res.json(roomInf)
......
......@@ -4,16 +4,13 @@ import User from "../models/User.js";
const roomEnter = async (req, res) => {
const roomId = req.body.enterCode
// console.log(req)
try {
const room = await Room.findOne({ roomId })
if (!room) {
return res.status(404).send(`참여코드가 존재하지 않습니다.`)
}
console.log('roomId존재')
const name = await Room.findOne({ roomId: roomId }).select('roomName')
return res.json(name.roomName)
......
......@@ -3,7 +3,6 @@ import isLength from 'validator/lib/isLength.js'
import isEmail from 'validator/lib/isEmail.js'
import bcrypt from "bcryptjs";
import multer from "multer";
import AccessInfo from "../models/AccessInfo.js"
const upload = multer({ dest: 'uploads/' })
const profileUpload = upload.fields([
......@@ -87,7 +86,6 @@ const getProfile = (req, res) => {
const checkUser = async (req, res) => {
try {
const info = await User.findOne({ _id: req.query._id })
console.log('info 확인', info)
return res.json(info)
} catch (error) {
console.log(error)
......
import mongoose from 'mongoose'
const { String } = mongoose.Schema.Types
const AccessInfoSchema = new mongoose.Schema({
room: {
type: mongoose.ObjectId,
required: true,
ref: 'Room',
},
userInfo: {
type: mongoose.ObjectId,
required: true,
unique: true,
ref: 'User',
},
nickname: {
type: String,
required: true,
},
isEnt: {
type: Boolean,
required: true,
default: true, // 입장 시 true, 퇴장 시 false
}
}, {
timestamps: true
})
export default mongoose.models.AccessInfo || mongoose.model('AccessInfo', AccessInfoSchema)
\ No newline at end of file
......@@ -38,11 +38,10 @@ const UserSchema = new mongoose.Schema({
type: Array,
}
}, {
//옵셥을 정의함.
timestamps: true
//기본이 false로 되어있음
//user가 추가될때마다 createdAt(만들어진 시간 저장)과 updatedAt(수정될때 시간이 변경되어 저장)가 추가되어 시간을 저장함.
})
export default mongoose.models.User || mongoose.model('User', UserSchema)
//user라는 이름이 있으면 앞을 return하고 없으면 뒤를 실행함
......@@ -10,11 +10,6 @@ router.route('/auth/login')
router.route('/auth/logout')
.get(authCtrl.logout)
// /api/users/signup로 들어오는 것을 post (method) 를 통해 useCtrl.signup 이것이 처리함
//browser에서 주소창에 치고 들어가면 get (method) 을 타고 들어간것임
//post를 띄우고 싶으면 앱에서 ARC실행해서 post를 실행하게 만들면됨.
//객체에 접근할때는 .을 찍고 접근함/ ex) .hello
//express middleware : (req, res) => {}
//node(req(client의 정보), res)를 넘겨줌.
export default router
\ No newline at end of file
......@@ -22,9 +22,6 @@ router.route('/room/member')
router.route('/room/getRoomName')
.get(roomCtrl.getRoomName)
// router.route('/room/sysMsg')
// .get(roomCtrl.sysMsg)
// router.route('/room/unreadMessage')
// .get(roomCtrl.unreadMessage)
router.route('/room/unreadMessage')
......
......@@ -33,13 +33,7 @@ io.on("connection", (socket) => { // 기본 연결
let roomInfo = data;
socket.leave(roomInfo); //클라이언트에서 data에 적힌 room정보를 브로드캐스팅 받지 않는다.
});
socket.on('newUser', (data) => {
console.log('newUser', data)
let userInfo = data.userInfo;
io.to(data.rmIf).emit('sendUser', userInfo)
})
socket.on('chat', async (data) => {
console.log('roomname확인', data)
const room = await Room.findOne({ roomId: data.roomInfo })
......
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