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

chat수정

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