Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
bora-it
Commits
6aeb3ac5
Commit
6aeb3ac5
authored
Aug 04, 2021
by
seoyeon
Browse files
Merge remote-tracking branch 'origin/jaeyeon' into seoyeon3
parents
65c7735b
d7cf7826
Changes
4
Hide whitespace changes
Inline
Side-by-side
client/src/components/Home/RoomSingle.js
View file @
6aeb3ac5
...
...
@@ -38,7 +38,6 @@ const RoomSingle = () => {
useEffect
(()
=>
{
getJoinRoom
(
id
);
},
[
id
]);
console
.
log
(
room
)
const
{
profileimg
}
=
room
;
return
(
...
...
@@ -46,7 +45,7 @@ const RoomSingle = () => {
{
room
&&
room
.
map
((
el
)
=>
(
<
div
>
{
room
===
INIT_ROOM
?
(
<
div
><
/div>
)
:
(
{
room
[
0
]
===
INIT_ROOM
?
(
<
div
><
/div>
)
:
(
<
Link
to
=
{
`/room/
${
el
.
roomId
}
/
${
channelId
}
`
}
className
=
"
text-decoration-none text-dark
"
...
...
client/src/components/Room/InitRoom.js
View file @
6aeb3ac5
...
...
@@ -19,6 +19,7 @@ const InitRoom = () => {
const
data
=
await
roomApi
.
getRoom
([
roomId
]);
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
);
}
...
...
client/src/components/Room/RightHamburger.js
View file @
6aeb3ac5
...
...
@@ -5,70 +5,69 @@ import RoomApi from "../../apis/room.api";
import
catchErrors
from
"
../../context/catchError
"
;
const
INIT_ROOM
=
{
name
:
""
,
};
name
:
""
,
};
const
INIT_CHANNEL
=
{
channelName
:
""
,
joinName
:
[],
channelName
:
""
,
joinName
:
[],
};
const
RightHamburger
=
()
=>
{
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
);
}
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
)
{
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
(()
=>
{
getChannel
(
roomId
);
getRoom
(
roomId
)
getRoom
(
roomId
)
;
},
[
roomId
]);
function
roomIdCopy
()
{
...
...
@@ -127,86 +126,83 @@ const RightHamburger = () => {
><
/button
>
<
/div
>
<
div
>
<
ChannelSingle
channel
=
{
channel
}
/
>
<
div
className
=
"
d-flex flex-row-reverse
"
>
<
button
type
=
"
button
"
className
=
"
m-3 rounded
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#inviteRoom
"
style
=
{{
height
:
"
30px
"
,
fontWeight
:
"
bold
"
,
backgroundColor
:
"
#E0CEE8
"
,
color
:
"
black
"
,
border
:
"
1px #D64D61
"
,
}}
>
초대
<
/button
>
<
div
className
=
"
modal fade
"
id
=
"
inviteRoom
"
tabIndex
=
"
-1
"
aria
-
labelledby
=
"
exitRoomLabel
"
aria
-
hidden
=
"
true
"
>
<
div
className
=
"
modal-dialog
"
>
<
div
className
=
"
modal-content
"
>
<
div
className
=
"
modal-header
"
>
<
button
type
=
"
button
"
className
=
"
btn-close
"
data
-
bs
-
dismiss
=
"
modal
"
aria
-
label
=
"
Close
"
><
/button
>
<
/div
>
<
div
className
=
"
modal-body d-flex justify-content-center
"
>
어떤
방식으로
초대하시겠습니까
?
<
/div
>
<
div
className
=
"
row mb-3
"
>
<
div
className
=
"
d-flex justify-content-evenly
"
>
<
button
type
=
"
submit
"
className
=
"
col-2 p-1 btn btn-primary
"
style
=
{{
width
:
"
120px
"
}}
>
카카오로
초대
<
/button
>
<
button
type
=
"
submit
"
className
=
"
col-2 p-1 btn btn-primary
"
data
-
bs
-
dismiss
=
"
modal
"
style
=
{{
width
:
"
120px
"
}}
onClick
=
{
roomIdCopy
}
>
방
Id
복사
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
ChannelSingle
channel
=
{
channel
}
/
>
<
div
className
=
"
d-flex flex-row-reverse
"
>
<
button
type
=
"
button
"
className
=
"
m-3 rounded
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#inviteRoom
"
style
=
{{
height
:
"
30px
"
,
fontWeight
:
"
bold
"
,
backgroundColor
:
"
#E0CEE8
"
,
color
:
"
black
"
,
border
:
"
1px #D64D61
"
,
}}
>
초대
<
/button
>
<
div
className
=
"
modal fade
"
id
=
"
inviteRoom
"
tabIndex
=
"
-1
"
aria
-
labelledby
=
"
exitRoomLabel
"
aria
-
hidden
=
"
true
"
>
<
div
className
=
"
modal-dialog
"
>
<
div
className
=
"
modal-content
"
>
<
div
className
=
"
modal-header
"
>
<
button
type
=
"
button
"
className
=
"
btn-close
"
data
-
bs
-
dismiss
=
"
modal
"
aria
-
label
=
"
Close
"
><
/button
>
<
/div
>
<
div
className
=
"
modal-body d-flex justify-content-center
"
>
어떤
방식으로
초대하시겠습니까
?
<
/div
>
<
div
className
=
"
row mb-3
"
>
<
div
className
=
"
d-flex justify-content-evenly
"
>
<
button
type
=
"
submit
"
className
=
"
col-2 p-1 btn btn-primary
"
style
=
{{
width
:
"
120px
"
}}
>
카카오로
초대
<
/button
>
<
button
type
=
"
submit
"
className
=
"
col-2 p-1 btn btn-primary
"
data
-
bs
-
dismiss
=
"
modal
"
style
=
{{
width
:
"
120px
"
}}
onClick
=
{
roomIdCopy
}
>
방
Id
복사
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
div
>
<
div
className
=
"
d-flex flex-row-reverse
"
>
<
button
type
=
"
button
"
className
=
"
m-3 rounded text-white
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#exitRoom
"
style
=
{{
height
:
"
30px
"
,
fontWeight
:
"
bold
"
,
backgroundColor
:
"
#d86da6
"
,
color
:
"
black
"
,
border
:
"
1px #d86da6
"
,
}}
>
퇴장
<
/button
>
{
/* {admin ? (
<
/div
>
<
/div
>
<
div
className
=
"
d-flex flex-row-reverse
"
>
<
button
type
=
"
button
"
className
=
"
m-3 rounded text-white
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#exitRoom
"
style
=
{{
height
:
"
30px
"
,
fontWeight
:
"
bold
"
,
backgroundColor
:
"
#d86da6
"
,
color
:
"
black
"
,
border
:
"
1px #d86da6
"
,
}}
>
퇴장
<
/button
>
{
/* {admin ? (
<button
type="button"
className="m-3 rounded"
...
...
@@ -222,55 +218,59 @@ const RightHamburger = () => {
</button>
) : null} */
}
<
div
className
=
"
modal fade
"
id
=
"
exitRoom
"
tabIndex
=
"
-1
"
aria
-
labelledby
=
"
exitRoomLabel
"
aria
-
hidden
=
"
true
"
<
div
className
=
"
modal fade
"
id
=
"
exitRoom
"
tabIndex
=
"
-1
"
aria
-
labelledby
=
"
exitRoomLabel
"
aria
-
hidden
=
"
true
"
>
<
div
className
=
"
modal-dialog
"
>
<
div
className
=
"
modal-content
"
>
<
div
className
=
"
modal-header
"
>
<
button
type
=
"
button
"
className
=
"
btn-close
"
data
-
bs
-
dismiss
=
"
modal
"
aria
-
label
=
"
Close
"
><
/button
>
<
/div
>
<
div
className
=
"
modal-body d-flex justify-content-center
"
>
이방에서
퇴장하시겠습니까
?
<
/div
>
<
div
className
=
"
row mb-3
"
>
<
div
className
=
"
d-flex justify-content-evenly
"
>
<
Link
to
=
{
`/user/
${
id
}
`
}
className
=
"
col-2 p-1 btn btn-primary
"
>
<
button
type
=
"
button
"
onClick
=
{
exitRoom
}
className
=
"
btn btn-primary
"
data
-
bs
-
dismiss
=
"
modal
"
>
예
<
/button
>
<
/Link
>
<
button
type
=
"
submit
"
className
=
"
btn btn-primary
"
data
-
bs
-
dismiss
=
"
modal
"
>
<
div
className
=
"
modal-dialog
"
>
<
div
className
=
"
modal-content
"
>
<
div
className
=
"
modal-header
"
>
<
button
type
=
"
button
"
className
=
"
btn-close
"
data
-
bs
-
dismiss
=
"
modal
"
aria
-
label
=
"
Close
"
><
/button
>
<
/div
>
<
div
className
=
"
modal-body d-flex justify-content-center
"
>
이방에서
퇴장하시겠습니까
?
<
/div
>
<
div
className
=
"
row mb-3
"
>
<
div
className
=
"
d-flex justify-content-evenly
"
>
<
Link
to
=
{
`/user/
${
id
}
`
}
className
=
"
col-2 p-1 btn btn-primary
"
>
<
button
type
=
"
button
"
onClick
=
{
exitRoom
}
className
=
"
btn btn-primary
"
data
-
bs
-
dismiss
=
"
modal
"
>
예
<
/button
>
<
/Link
>
<
button
type
=
"
submit
"
className
=
"
btn btn-primary
"
data
-
bs
-
dismiss
=
"
modal
"
>
아니요
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
아니요
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
);
};
<
/div
>
<
/div
>
);
};
export
default
RightHamburger
;
\ No newline at end of file
export
default
RightHamburger
;
server/app.js
View file @
6aeb3ac5
...
...
@@ -19,6 +19,10 @@ const io = new Server(server, {
app
.
use
(
express
.
json
());
app
.
use
(
express
.
urlencoded
({
extended
:
true
}));
app
.
use
(
cookieParser
());
app
.
use
(
'
/uploads
'
,
express
.
static
(
'
uploads
'
))
app
.
use
(
'
/roomUploads
'
,
express
.
static
(
'
roomUploads
'
))
app
.
use
(
"
/api
"
,
mainRouter
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment