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
bdbf406c
Commit
bdbf406c
authored
Aug 02, 2021
by
우지원
Browse files
e
parent
0c3731f4
Changes
3
Show whitespace changes
Inline
Side-by-side
client/src/components/Home/CreateRoom.js
View file @
bdbf406c
...
...
@@ -3,11 +3,11 @@ import { Redirect } from "react-router-dom";
import
roomApi
from
"
../../apis/room.api
"
;
import
catchErrors
from
"
../../context/catchError
"
;
const
userI
d
=
localStorage
.
getItem
(
'
user
'
);
const
i
d
=
localStorage
.
getItem
(
'
user
'
);
const
INIT_ROOM
=
{
name
:
''
,
owner
:
userI
d
,
member
:
userI
d
,
owner
:
i
d
,
member
:
i
d
,
profileimg
:
''
,
}
...
...
@@ -43,9 +43,9 @@ const CreateRoom = () => {
}
if
(
success
)
{
console
.
log
(
'
success
'
,
success
)
//
console.log('success', success)
alert
(
'
룸생성이 완료되었습니다!
'
)
return
<
Redirect
to
=
'
/user/
:id
'
/>
return
<
Redirect
to
=
{
`
/user/
${
id
}
`
}
/
>
}
const
{
name
,
owner
,
member
,
profileimg
}
=
room
;
...
...
client/src/components/Home/JoinRoom.js
View file @
bdbf406c
...
...
@@ -3,7 +3,7 @@ import { Redirect } from "react-router-dom";
import
roomApi
from
"
../../apis/room.api
"
;
import
catchErrors
from
"
../../context/catchError
"
;
const
userI
d
=
localStorage
.
getItem
(
"
user
"
);
const
i
d
=
localStorage
.
getItem
(
"
user
"
);
const
JoinRoom
=
()
=>
{
const
[
roomId
,
setRoomId
]
=
useState
(
""
);
...
...
@@ -26,7 +26,7 @@ const JoinRoom = () => {
try
{
// setLoading(true);
setError
(
""
);
const
data
=
await
roomApi
.
join
({
userId
:
userI
d
,
roomId
:
roomId
});
const
data
=
await
roomApi
.
join
({
userId
:
i
d
,
roomId
:
roomId
});
setSuccess
(
true
);
}
catch
(
error
)
{
catchErrors
(
error
,
setError
);
...
...
@@ -34,8 +34,11 @@ const JoinRoom = () => {
// setLoading(false);
}
}
if
(
success
)
{
return
<
Redirect
to
=
"
/user
"
/>
;
// console.log('success', success)
alert
(
'
룸참여가 완료되었습니다!
'
)
return
<
Redirect
to
=
{
`/user/
${
id
}
`
}
/>
;
}
return
(
...
...
client/src/components/Home/RoomSingle.js
View file @
bdbf406c
...
...
@@ -6,7 +6,7 @@ import userApi from '../../apis/user.api';
const
RoomSingle
=
()
=>
{
const
[
roomNum
,
setRoomNum
]
=
useState
(
''
)
const
[
room
,
setRoom
]
=
useState
([])
const
i
d
=
localStorage
.
getItem
(
'
user
'
);
const
roomI
d
=
localStorage
.
getItem
(
'
user
'
);
const
channelId
=
1
const
A
=
[]
...
...
@@ -30,7 +30,7 @@ const RoomSingle = () => {
return
(
<
Link
to
=
{
`/room/
${
i
d
}
/
${
channelId
}
`
}
to
=
{
`/room/
${
roomI
d
}
/
${
channelId
}
`
}
className
=
"
text-decoration-none text-dark
"
>
<
div
...
...
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