Commit b21d2576 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

chat수정

parent e2bdbc19
......@@ -34,7 +34,7 @@ function Chat(props) {
<div className="chat" id="chat" style={{ border: "2px solid", height: "300%", margin: "1%", borderColor: "#BDBDBD" }}>
<h2>현재 {props.roomName} 입니다.</h2>
{ chat.map((value, index) => {
if (Boolean(value)) {
if (!(value=='')) {
// console.log(`value=${value}=`)
return <Row key={index} className='ml-3'>
{props.roomName}에서 {defaultname}님이 보낸 메세지 : {value}
......
import React, { useState, useEffect } from 'react'
import React from 'react'
import { Navbar, Nav, Button } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import { handleLogout } from '../utils/auth';
import axios from 'axios'
function Menu() {
......@@ -16,7 +14,6 @@ function Menu() {
<>
<div className='ml-1 mr-2' style={{ color: 'white' }}>{name} 환영합니다</div>
<Nav className="mr-auto">
{/* <Nav.Link href="/home">Home</Nav.Link> */}
<Nav.Link href="/profile">Profile</Nav.Link>
</Nav>
<Button className="ml-auto" onClick={() => handleLogout()} variant="light" className="ml-3">Logout</Button>
......
......@@ -33,7 +33,7 @@ function Home() {
const handleChato = () => setChat(true);
const handleChatc = () => setChat(false);
//SOCKET 관련 시작
function enterChatroom(rName) { //방 입장하기
......@@ -46,10 +46,13 @@ function Home() {
}
useEffect(() => {
socket.emit("chat", {
roomName: roomCode,
msg: singleChat
})
if (!(singleChat == '')) {
socket.emit("chat", {
roomName: roomCode,
msg: singleChat
})
setSingleChat([''])
}
}, [singleChat])
......
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