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
5486346c
Commit
5486346c
authored
Aug 06, 2021
by
이재연
Browse files
z
parent
1da6b905
Changes
6
Hide whitespace changes
Inline
Side-by-side
client/src/components/Home/CreateRoom.js
View file @
5486346c
...
...
@@ -27,7 +27,6 @@ const CreateRoom = () => {
}
else
{
setRoom
({
...
room
,
[
name
]:
value
})
}
console
.
log
(
room
)
}
async
function
handleSubmit
(
e
)
{
...
...
client/src/components/Room/ChannelSingle.js
View file @
5486346c
...
...
@@ -9,24 +9,17 @@ const ChannelSingle = (props) => {
const
[
succes
,
setSucces
]
=
useState
(
false
);
const
[
roomName
,
setRoomName
]
=
useState
(
''
);
const
{
roomId
,
channelId
}
=
useParams
();
console
.
log
(
'
props
'
,
props
.
channel
)
console
.
log
(
'
hi
'
,
channelId
)
const
userId
=
localStorage
.
getItem
(
'
user
'
)
async
function
joinChannel
(
e
)
{
console
.
log
(
e
,
userId
)
try
{
const
data
=
await
userApi
.
getUser
(
userId
);
const
key
=
indexCheck
(
e
)
console
.
log
(
key
)
const
mem
=
props
.
channel
[
key
].
joinUser
console
.
log
(
mem
)
const
joinCh
=
mem
.
includes
(
data
.
name
);
console
.
log
(
joinCh
)
if
(
!
joinCh
)
{
const
roomA
=
await
roomApi
.
joinChannel
({
roomId
:
roomId
,
channelName
:
e
,
plusUser
:
data
.
name
,
index
:
key
})
console
.
log
(
roomA
)
setRoomName
(
e
)
setSucces
(
true
)
}
else
{
...
...
@@ -39,10 +32,7 @@ const ChannelSingle = (props) => {
function
indexCheck
(
e
)
{
for
(
const
key
in
props
.
channel
)
{
console
.
log
(
'
체크
'
,
props
.
channel
[
key
].
channelName
,
e
)
console
.
log
(
'
체크
'
,
props
.
channel
[
key
].
channelName
===
e
)
if
(
props
.
channel
[
key
].
channelName
===
e
)
{
console
.
log
(
'
key
'
,
key
)
return
key
}
}
...
...
client/src/components/Room/InitRoom.js
View file @
5486346c
...
...
@@ -17,9 +17,7 @@ const InitRoom = () => {
async
function
getRoom
(
roomId
)
{
try
{
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 @
5486346c
...
...
@@ -43,14 +43,10 @@ const RightHamburger = () => {
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
,
joinUser
:
Channel
[
prop
][
key
],
...
...
server/controllers/room.controller.js
View file @
5486346c
...
...
@@ -124,10 +124,13 @@ const joinChannel = async (req, res) => {
const
room
=
await
Room
.
findOne
({
where
:
{
id
:
roomId
}
});
room
.
channel
[
index
][
channelName
].
push
(
plusUser
)
console
.
log
(
'
확인2
'
,
room
.
channel
[
index
])
await
Room
.
update
({
channel
:
room
.
channel
},
{
where
:
{
id
:
roomId
}
});
return
res
.
json
(
true
)
}
export
default
{
joinRoom
,
roomImgUpload
,
createRoom
,
getRoom
,
exitRoom
,
joinChannel
,
};
server/index.js
View file @
5486346c
...
...
@@ -23,22 +23,6 @@ sequelize
roomNumber
:
[
"
1234567abc
"
,
"
abc7654321
"
],
});
await
Room
.
create
({
id
:
"
1234567abc
"
,
name
:
"
room
"
,
owner
:
8888
,
member
:
[
'
8888
'
,
'
9999
'
],
profileimg
:
"
defaultimg
"
,
});
await
Room
.
create
({
id
:
"
abc7654321
"
,
name
:
"
room1
"
,
owner
:
9999
,
member
:
[
'
9999
'
],
profileimg
:
"
defaultimg
"
,
});
app
.
listen
(
appConfig
.
port
,
()
=>
{
console
.
log
(
`Server is running on port
${
appConfig
.
port
}
`
);
});
...
...
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