OpenList.js 825 Bytes
Newer Older
1
import React, { useState, useEffect } from 'react'
우지원's avatar
ul    
우지원 committed
2
import { ListGroup } from 'react-bootstrap';
3
import axios from 'axios'
우지원's avatar
ul    
우지원 committed
4

Soo Hyun Kim's avatar
soo0115    
Soo Hyun Kim committed
5
6
function OpenList(props) {

Soo Hyun Kim's avatar
Soo Hyun Kim committed
7
  function enterChatRoomCH(e) {
Soo Hyun Kim's avatar
Soo Hyun Kim committed
8
9
10
11
    if (props.roomCode){
      props.closeChatRoom(props.roomCode)
    }
    
Choi Ga Young's avatar
Choi Ga Young committed
12
    console.log('e확인', e.target)
13
    const roomCode = e.target.name
Choi Ga Young's avatar
Choi Ga Young committed
14
15
    // props.enterChatRoom(roomCode) // 각각의 room으로 들어가도록 설정해야 함
    props.openListroom(roomCode)
16
    props.setRoomCode(roomCode)
Soo Hyun Kim's avatar
soo0115    
Soo Hyun Kim committed
17
18
19
    // props.clearChat()
  }

우지원's avatar
ul    
우지원 committed
20
21
  return (
    <div>
22
      {props.openlist.map((item, index) =>
우지원's avatar
ul    
우지원 committed
23
        <ListGroup key={index}>
24
          <ListGroup.Item action onClick={enterChatRoomCH} name={item.roomId}>
Choi Ga Young's avatar
Choi Ga Young committed
25
            {item.roomName}
우지원's avatar
ul    
우지원 committed
26
27
28
29
30
31
32
33
          </ListGroup.Item>
        </ListGroup>
      )}
    </div>
  )
}

export default OpenList