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
Show whitespace changes
Inline
Side-by-side
client/src/components/Home/RoomSingle.js
View file @
6aeb3ac5
...
@@ -38,7 +38,6 @@ const RoomSingle = () => {
...
@@ -38,7 +38,6 @@ const RoomSingle = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
getJoinRoom
(
id
);
getJoinRoom
(
id
);
},
[
id
]);
},
[
id
]);
console
.
log
(
room
)
const
{
profileimg
}
=
room
;
const
{
profileimg
}
=
room
;
return
(
return
(
...
@@ -46,7 +45,7 @@ const RoomSingle = () => {
...
@@ -46,7 +45,7 @@ const RoomSingle = () => {
{
room
&&
{
room
&&
room
.
map
((
el
)
=>
(
room
.
map
((
el
)
=>
(
<
div
>
<
div
>
{
room
===
INIT_ROOM
?
(
<
div
><
/div>
)
:
(
{
room
[
0
]
===
INIT_ROOM
?
(
<
div
><
/div>
)
:
(
<
Link
<
Link
to
=
{
`/room/
${
el
.
roomId
}
/
${
channelId
}
`
}
to
=
{
`/room/
${
el
.
roomId
}
/
${
channelId
}
`
}
className
=
"
text-decoration-none text-dark
"
className
=
"
text-decoration-none text-dark
"
...
...
client/src/components/Room/InitRoom.js
View file @
6aeb3ac5
...
@@ -19,6 +19,7 @@ const InitRoom = () => {
...
@@ -19,6 +19,7 @@ const InitRoom = () => {
const
data
=
await
roomApi
.
getRoom
([
roomId
]);
const
data
=
await
roomApi
.
getRoom
([
roomId
]);
console
.
log
(
data
)
console
.
log
(
data
)
setRoom
({...
room
,
id
:
data
[
0
].
id
,
name
:
data
[
0
].
name
,
profileimg
:
data
[
0
].
profileimg
})
setRoom
({...
room
,
id
:
data
[
0
].
id
,
name
:
data
[
0
].
name
,
profileimg
:
data
[
0
].
profileimg
})
console
.
log
(
room
.
profileimg
)
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
);
catchErrors
(
error
,
setError
);
}
}
...
...
client/src/components/Room/RightHamburger.js
View file @
6aeb3ac5
...
@@ -6,7 +6,7 @@ import catchErrors from "../../context/catchError";
...
@@ -6,7 +6,7 @@ import catchErrors from "../../context/catchError";
const
INIT_ROOM
=
{
const
INIT_ROOM
=
{
name
:
""
,
name
:
""
,
};
};
const
INIT_CHANNEL
=
{
const
INIT_CHANNEL
=
{
channelName
:
""
,
channelName
:
""
,
...
@@ -14,47 +14,46 @@ const INIT_CHANNEL = {
...
@@ -14,47 +14,46 @@ const INIT_CHANNEL = {
};
};
const
RightHamburger
=
()
=>
{
const
RightHamburger
=
()
=>
{
const
[
channel
,
setChannel
]
=
useState
([
INIT_CHANNEL
]);
const
[
channel
,
setChannel
]
=
useState
([
INIT_CHANNEL
]);
const
[
room
,
setRoom
]
=
useState
([
INIT_ROOM
])
const
[
room
,
setRoom
]
=
useState
([
INIT_ROOM
])
;
const
{
roomId
}
=
useParams
();
const
{
roomId
}
=
useParams
();
const
[
error
,
setError
]
=
useState
(
""
);
const
[
error
,
setError
]
=
useState
(
""
);
const
id
=
localStorage
.
getItem
(
'
user
'
);
const
id
=
localStorage
.
getItem
(
"
user
"
);
async
function
getRoom
(
roomId
)
{
async
function
getRoom
(
roomId
)
{
try
{
try
{
const
data
=
await
RoomApi
.
getRoom
([
roomId
]);
const
data
=
await
RoomApi
.
getRoom
([
roomId
]);
setRoom
({...
room
,
name
:
data
[
0
].
name
});
setRoom
({
...
room
,
name
:
data
[
0
].
name
});
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
);
catchErrors
(
error
,
setError
);
}
}
}
}
async
function
exitRoom
()
{
async
function
exitRoom
()
{
console
.
log
(
'
id, roomid정보
'
,
id
,
roomId
)
console
.
log
(
"
id, roomid정보
"
,
id
,
roomId
)
;
try
{
try
{
const
data
=
await
RoomApi
.
exitRoom
({
id
,
roomId
})
const
data
=
await
RoomApi
.
exitRoom
({
id
,
roomId
})
;
console
.
log
(
data
)
console
.
log
(
data
)
;
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
);
catchErrors
(
error
,
setError
);
}
}
}
}
async
function
getChannel
(
roomId
)
{
async
function
getChannel
(
roomId
)
{
const
ID
=
roomId
const
ID
=
roomId
;
try
{
try
{
const
data
=
await
RoomApi
.
getRoom
([
ID
]);
const
data
=
await
RoomApi
.
getRoom
([
ID
]);
const
Channel
=
data
[
0
].
channel
const
Channel
=
data
[
0
].
channel
;
console
.
log
(
'
방데이터:
'
,
Channel
)
console
.
log
(
"
방데이터:
"
,
Channel
)
;
const
channelList
=
[];
const
channelList
=
[];
for
(
const
prop
in
Channel
)
{
// Channel의 항목(prop)으로 작업을 실행합니다
for
(
const
prop
in
Channel
)
{
// Channel의 항목(prop)으로 작업을 실행합니다
for
(
const
key
in
Channel
[
prop
])
{
for
(
const
key
in
Channel
[
prop
])
{
console
.
log
(
key
)
console
.
log
(
key
)
;
console
.
log
(
prop
)
console
.
log
(
prop
)
;
console
.
log
(
Channel
[
prop
][
key
])
console
.
log
(
Channel
[
prop
][
key
])
;
channelList
.
push
({
channelList
.
push
({
channelName
:
key
,
channelName
:
key
,
joinName
:
Channel
[
prop
][
key
]
joinName
:
Channel
[
prop
][
key
]
,
});
});
}
}
}
}
...
@@ -68,7 +67,7 @@ const RightHamburger = () => {
...
@@ -68,7 +67,7 @@ const RightHamburger = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
getChannel
(
roomId
);
getChannel
(
roomId
);
getRoom
(
roomId
)
getRoom
(
roomId
)
;
},
[
roomId
]);
},
[
roomId
]);
function
roomIdCopy
()
{
function
roomIdCopy
()
{
...
@@ -187,9 +186,6 @@ const RightHamburger = () => {
...
@@ -187,9 +186,6 @@ const RightHamburger = () => {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
>
<
div
className
=
"
d-flex flex-row-reverse
"
>
<
div
className
=
"
d-flex flex-row-reverse
"
>
<
button
<
button
type
=
"
button
"
type
=
"
button
"
...
@@ -244,7 +240,10 @@ const RightHamburger = () => {
...
@@ -244,7 +240,10 @@ const RightHamburger = () => {
<
/div
>
<
/div
>
<
div
className
=
"
row mb-3
"
>
<
div
className
=
"
row mb-3
"
>
<
div
className
=
"
d-flex justify-content-evenly
"
>
<
div
className
=
"
d-flex justify-content-evenly
"
>
<
Link
to
=
{
`/user/
${
id
}
`
}
className
=
"
col-2 p-1 btn btn-primary
"
>
<
Link
to
=
{
`/user/
${
id
}
`
}
className
=
"
col-2 p-1 btn btn-primary
"
>
<
button
<
button
type
=
"
button
"
type
=
"
button
"
onClick
=
{
exitRoom
}
onClick
=
{
exitRoom
}
...
@@ -270,7 +269,8 @@ const RightHamburger = () => {
...
@@ -270,7 +269,8 @@ const RightHamburger = () => {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
);
);
};
};
export
default
RightHamburger
;
export
default
RightHamburger
;
server/app.js
View file @
6aeb3ac5
...
@@ -19,6 +19,10 @@ const io = new Server(server, {
...
@@ -19,6 +19,10 @@ const io = new Server(server, {
app
.
use
(
express
.
json
());
app
.
use
(
express
.
json
());
app
.
use
(
express
.
urlencoded
({
extended
:
true
}));
app
.
use
(
express
.
urlencoded
({
extended
:
true
}));
app
.
use
(
cookieParser
());
app
.
use
(
cookieParser
());
app
.
use
(
'
/uploads
'
,
express
.
static
(
'
uploads
'
))
app
.
use
(
'
/roomUploads
'
,
express
.
static
(
'
roomUploads
'
))
app
.
use
(
"
/api
"
,
mainRouter
);
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