RoomSingle.js 1.74 KB
Newer Older
Kim, Chaerin's avatar
Kim, Chaerin committed
1
2
3
4
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import roomApi from "../../apis/room.api";
import userApi from "../../apis/user.api";
Kim, Chaerin's avatar
Kim, Chaerin committed
5

Kim, Chaerin's avatar
Kim, Chaerin committed
6
const RoomSingle = () => {
Kim, Chaerin's avatar
Kim, Chaerin committed
7
8
9
10
11
  const [roomNum, setRoomNum] = useState("");
  const [room, setRoom] = useState([]);
  const roomId = localStorage.getItem("user");
  const channelId = 1;
  const A = [];
Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

  // async function getJoinRoom(Id) {
  //   try {
  //     console.log('id:',id)
  //     const User = await userApi.getUser({id: Id})
  //     console.log('User1:',User)
  //     console.log('User2:',User.roomNumber)
  //     const RoomNumArr = User.roomNumber
  //     console.log('setRoomNum:',RoomNumArr)
  //     const Room = await roomApi.getRoom(RoomNumArr)
  //   } catch (error) {
  //     // catchErrors(error, setError)
  //   }
  // }

  // useEffect(() => {
  //   getJoinRoom(id)
  // }, [id])

Kim, Chaerin's avatar
Kim, Chaerin committed
31
  return (
seoyeon's avatar
seoyeon committed
32
    <Link
Kim, Chaerin's avatar
Kim, Chaerin committed
33
      to={`/room/${roomId}/${channelId}`}
seoyeon's avatar
seoyeon committed
34
35
      className="text-decoration-none text-dark"
    >
Kim, Chaerin's avatar
Kim, Chaerin committed
36
      <div
우지원's avatar
우지원 committed
37
        className="d-flex mx-4 my-2 p-2"
Kim, Chaerin's avatar
Kim, Chaerin committed
38
        style={{ backgroundColor: "#C4C4C4" }}
Kim, Chaerin's avatar
Kim, Chaerin committed
39
      >
Kim, Chaerin's avatar
Kim, Chaerin committed
40
        <div style={{ width: "37px", height: "37px" }}>
Kim, Chaerin's avatar
Kim, Chaerin committed
41
          <img
Kim, Chaerin's avatar
Kim, Chaerin committed
42
            alt="roomImg"
Kim, Chaerin's avatar
Kim, Chaerin committed
43
44
            src="BORA.png"
            className="rounded-circle"
Kim, Chaerin's avatar
Kim, Chaerin committed
45
            style={{ width: "37px", height: "37px" }}
Kim, Chaerin's avatar
Kim, Chaerin committed
46
47
          />
        </div>
seoyeon's avatar
seoyeon committed
48
49
50
        <div
          className="mx-3 mt-2"
          style={{
Kim, Chaerin's avatar
Kim, Chaerin committed
51
52
53
54
            width: "250px",
            overflow: "scroll",
            whiteSpace: "nowrap",
            msOverflowStyle: "none",
seoyeon's avatar
seoyeon committed
55
56
57
58
          }}
        >
          데계 재미있는 수학과 데계데계데계 재미있는 수학과
        </div>
우지원's avatar
우지원 committed
59
        <div className="ms-auto mt-2"> 15/34 </div>
Kim, Chaerin's avatar
Kim, Chaerin committed
60
      </div>
seoyeon's avatar
seoyeon committed
61
    </Link>
Kim, Chaerin's avatar
Kim, Chaerin committed
62
63
  );
};
Kim, Chaerin's avatar
Kim, Chaerin committed
64

Kim, Chaerin's avatar
Kim, Chaerin committed
65
export default RoomSingle;