+
+
+
)
}
diff --git a/client/src/components/Room/InitRoom.js b/client/src/components/Room/InitRoom.js
index c5dd990ab304e446850e8696f70b79494811bc56..65ffa885d351244469c22a91d30f3eb6e3032a98 100644
--- a/client/src/components/Room/InitRoom.js
+++ b/client/src/components/Room/InitRoom.js
@@ -17,7 +17,9 @@ const InitRoom = () => {
async function getRoom(roomId) {
try {
const data = await roomApi.getRoom([roomId]);
- setRoom(data[0]);
+ console.log(data)
+ setRoom({...room, id:data[0].id, name:data[0].name, profileimg: data[0].profileimg})
+ console.log(room.profileimg)
} catch (error) {
catchErrors(error, setError);
}
diff --git a/client/src/components/Room/RightHamburger.js b/client/src/components/Room/RightHamburger.js
index a1c4a71fe41edcd4150350a94251abfd26f26e39..707203e48b06f7a774b9b17da0baa8c419a43a28 100644
--- a/client/src/components/Room/RightHamburger.js
+++ b/client/src/components/Room/RightHamburger.js
@@ -1,132 +1,208 @@
import { useState, useEffect } from "react";
import { Link, useParams } from "react-router-dom";
import ChannelSingle from "./ChannelSingle";
-import Rightimg from "../../images/RightHamburgerImg.png";
import RoomApi from "../../apis/room.api";
-import roomApi from "../../apis/room.api";
import catchErrors from "../../context/catchError";
+const INIT_ROOM = {
+ name: "",
+};
+
const INIT_CHANNEL = {
- channelName: "",
- joinName: [],
+ channelName: "",
+ joinName: [],
};
const RightHamburger = () => {
- const [channel, setChannel] = useState([INIT_CHANNEL]);
- const { roomId } = useParams();
- const [error, setError] = useState("");
- const id = localStorage.getItem('user');
-
- async function exitRoom() {
- console.log('id, roomid정보', id, roomId)
- try {
- const data = await roomApi.exitRoom({ id, roomId })
- console.log(data)
- } catch (error) {
- catchErrors(error, setError);
- }
+ const [channel, setChannel] = useState([INIT_CHANNEL]);
+ const [room, setRoom] = useState([INIT_ROOM]);
+ const { roomId } = useParams();
+ const [error, setError] = useState("");
+ const id = localStorage.getItem("user");
+ async function getRoom(roomId) {
+ try {
+ const data = await RoomApi.getRoom([roomId]);
+ setRoom({ ...room, name: data[0].name });
+ } catch (error) {
+ catchErrors(error, setError);
+ }
+ }
+ async function exitRoom() {
+ console.log("id, roomid정보", id, roomId);
+ try {
+ const data = await RoomApi.exitRoom({ id, roomId });
+ console.log(data);
+ } catch (error) {
+ catchErrors(error, setError);
}
+ }
- async function getChannel(roomId) {
- // console.log('roomId', roomId)
- const ID = roomId
- try {
- const data = await roomApi.getRoom([ID]);
- const Channel = data[0].channel
- console.log('방데이터:', Channel)
- const channelList = [];
- for (const prop in Channel) { // Channel의 항목(prop)으로 작업을 실행합니다
- for (const key in Channel[prop]) {
- console.log(key)
- console.log(prop)
- console.log(Channel[prop][key])
- channelList.push({
- channelName: key,
- joinName: Channel[prop][key]
- });
- }
- }
- setChannel(channelList);
- } catch (error) {
- catchErrors(error, setError);
+ async function getChannel(roomId) {
+ const ID = roomId;
+ try {
+ const data = await RoomApi.getRoom([ID]);
+ const Channel = data[0].channel;
+ console.log("방데이터:", Channel);
+ const channelList = [];
+ for (const prop in Channel) {
+ // Channel의 항목(prop)으로 작업을 실행합니다
+ for (const key in Channel[prop]) {
+ console.log(key);
+ console.log(prop);
+ console.log(Channel[prop][key]);
+ channelList.push({
+ channelName: key,
+ joinName: Channel[prop][key],
+ });
}
+ }
+ setChannel(channelList);
+ } catch (error) {
+ catchErrors(error, setError);
}
- // console.log(channel)
+ }
- useEffect(() => {
- // console.log('roomId', roomId)
- getChannel(roomId);
- }, [roomId]);
- return (
+ // console.log(channel)
+
+ useEffect(() => {
+ getChannel(roomId);
+ getRoom(roomId);
+ }, [roomId]);
+
+ function roomIdCopy() {
+ const t = document.querySelector("#roomId").innerText;
+ console.log(t);
+ navigator.clipboard.writeText(t);
+ document.execCommand("copy");
+ }
+ return (
+
+
+
+
+
+
+
+ {room.name}
+
+
+ {" "}
+ {`${roomId}`}{" "}
+
+
+
-
-
-
+
+
+
-
-
- 방 이름{/*Room.name*/}
-
-
- {" "}
- {`${roomId}`}{" "}
-
+
+
+
+
+
+ 어떤 방식으로 초대하시겠습니까?
+
+
+
+
+
+
+
-
-
-
-
-
- {/* {admin ? (
+
+
+
+
+ {/* {admin ? (
) : null} */}
-
+
+
+
+
+
+
+ 이방에서 퇴장하시겠습니까?
+
+
+
+
-
-
-
-
-
-
- 이방에서 퇴장하시겠습니까?
-
-
-
-
- {/*
*/}
-
- {/*
*/}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
- );
+
+
+ );
};
-export default RightHamburger;
\ No newline at end of file
+export default RightHamburger;
diff --git a/client/src/components/SignUp.js b/client/src/components/SignUp.js
index 0da59d8a34d7ee877e461ed0ddc8c6fd71adcce3..a4f91ff7f23fdde8e08c6d33a4ed27fd38d6c199 100644
--- a/client/src/components/SignUp.js
+++ b/client/src/components/SignUp.js
@@ -66,91 +66,103 @@ const Signup = () => {
const { name, id, password, checkpw, phone } = user
return (
-