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