Commit 0e228dad authored by 우지원's avatar 우지원
Browse files

채널퇴장 오류해결

parent 5eb8bad9
......@@ -24,7 +24,7 @@ const ChannelSingle = (props) => {
if (A) {
await roomApi.doubleJoin({ roomId: roomId, index1: A.index1, index2: A.index2, joinChName: A.joinChName })
}
const roomA = await roomApi.joinChannel({ roomId: roomId, channelName: e, plusUser: data.name, index: index1 })
await roomApi.joinChannel({ roomId: roomId, channelName: e, plusUser: data.name, index: index1 })
setRoomName(e)
setSuccess(true)
} else {
......@@ -69,35 +69,33 @@ const ChannelSingle = (props) => {
<div className="overflow-auto" style={{ height: '610px' }}>
{props.channel.map((el,i) => (
<div className="mb-3" key={`channel${i}`}>
<Link to={`/room/${roomId}/${el.channelName}`}>
<div
className="m-3 p-1 row"
style={{ backgroundColor: '#E0CEE8' }}
onClick={() => joinChannel(el.channelName)}
>
{el.channelName === channelId ? (
<img
className="col-auto mt-2"
src="/fullSpeaker.png"
width="25px"
height="25px"
/>
) : (
<img
className="col-auto mt-2"
src="/emptySpeaker.png"
width="25px"
height="25px"
/>
)}
<h5 className="col mt-2" style={{ color: 'black' }}>
{el.channelName}
</h5>
</div>
</Link>
<div
className="m-3 p-1 row"
style={{ backgroundColor: '#E0CEE8' }}
onClick={() => joinChannel(el.channelName)}
>
{el.channelName === channelId ? (
<img
className="col-auto mt-2"
src="/fullSpeaker.png"
width="25px"
height="25px"
/>
) : (
<img
className="col-auto mt-2"
src="/emptySpeaker.png"
width="25px"
height="25px"
/>
)}
<h5 className="col mt-2" style={{ color: 'black' }}>
{el.channelName}
</h5>
</div>
{el.joinName &&
el.joinName.map((e,i) => (
{el.joinUser &&
el.joinUser.map((e,i) => (
<div key={`member${i}`}>
<ul className="mx-5" style={{ color: '#76D079' }}>
<li>
......
......@@ -17,7 +17,7 @@ const Roomnamechange = () => {
async function getdata(Roomdata) {
try {
const data = await RoomApi.getRoom(Roomdata);
const data = await RoomApi.getRoom([Roomdata]);
setRoom(data);
console.log(data);
} catch (error) {
......
......@@ -140,24 +140,16 @@ const changename = async (req, res) => {
const joinChannel = async (req, res) => {
const { roomId, channelName, plusUser, index } = req.body;
console.log("연결성공");
const room = await Room.findOne({ where: { id: roomId } });
room.channel[index][channelName].push(plusUser);
console.log("확인2", room.channel[index]);
console.log("확인2", room.channel);
await Room.update({ channel: room.channel }, { where: { id: roomId } });
return res.json(true);
};
const doubleJoin = async (req, res) => {
console.log("연결성공", req.body);
const { roomId, index1, index2, joinChName } = req.body;
console.log(index1);
const room = await Room.findOne({ where: { id: roomId } });
console.log(room.channel[index1][joinChName]);
room.channel[index1][joinChName].splice(index2, 1);
console.log(room.channel[index1][joinChName]);
console.log("room.channel", room.channel);
await Room.update({ channel: room.channel }, { where: { id: roomId } });
return res.json(true);
};
......
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