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
043dc302
Commit
043dc302
authored
Aug 04, 2021
by
우지원
Browse files
룸첫화면추가
parent
b41db3c2
Changes
8
Hide whitespace changes
Inline
Side-by-side
client/src/App.js
View file @
043dc302
...
@@ -8,6 +8,7 @@ import InfoUpdatePage from "./pages/InfoUpdatePage";
...
@@ -8,6 +8,7 @@ import InfoUpdatePage from "./pages/InfoUpdatePage";
import
InvitePage
from
"
./pages/InvitePage
"
;
import
InvitePage
from
"
./pages/InvitePage
"
;
import
SingupPage
from
"
./components/SignUp
"
;
import
SingupPage
from
"
./components/SignUp
"
;
import
LoginPage
from
"
./components/Login
"
import
LoginPage
from
"
./components/Login
"
import
InitRoomPage
from
"
./pages/InitRoomPage
"
;
function
App
()
{
function
App
()
{
return
(
return
(
...
@@ -20,7 +21,8 @@ function App() {
...
@@ -20,7 +21,8 @@ function App() {
<
Route
exact
path
=
"
/login
"
component
=
{
LoginPage
}
/
>
<
Route
exact
path
=
"
/login
"
component
=
{
LoginPage
}
/
>
<
Route
path
=
"
/profile/:id/update
"
component
=
{
InfoUpdatePage
}
/
>
<
Route
path
=
"
/profile/:id/update
"
component
=
{
InfoUpdatePage
}
/
>
<
Route
path
=
"
/profile/:id
"
component
=
{
ProfilePage
}
/
>
<
Route
path
=
"
/profile/:id
"
component
=
{
ProfilePage
}
/
>
<
Route
path
=
"
/room/:roomId/:channelId
"
component
=
{
RoomPage
}
>
<
Route
path
=
"
/room/:roomId/:channelId
"
component
=
{
RoomPage
}
/
>
<
Route
path
=
"
/room/:roomId
"
component
=
{
InitRoomPage
}
>
{
/* <Switch>
{
/* <Switch>
<Route path={"/room/:roomId/meeting"}>
<Route path={"/room/:roomId/meeting"}>
<></>
<></>
...
...
client/src/components/Profile/Profile.js
View file @
043dc302
...
@@ -15,12 +15,14 @@ const Profile = () => {
...
@@ -15,12 +15,14 @@ const Profile = () => {
async
function
getProfile
(
userID
)
{
async
function
getProfile
(
userID
)
{
try
{
try
{
const
data
=
await
userApi
.
getUser
(
userID
);
const
data
=
await
userApi
.
getUser
(
userID
);
console
.
log
(
data
)
setProfile
(
data
.
img
)
setProfile
(
data
.
img
)
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
);
catchErrors
(
error
,
setError
);
}
}
}
}
console
.
log
(
profile
)
useEffect
(()
=>
{
useEffect
(()
=>
{
getProfile
(
userprofile
);
getProfile
(
userprofile
);
},
[
userprofile
]);
},
[
userprofile
]);
...
...
client/src/components/Room/InitRoom.js
0 → 100644
View file @
043dc302
import
{
useEffect
,
useState
}
from
"
react
"
;
import
catchErrors
from
"
../../context/catchError
"
;
import
{
useParams
}
from
"
react-router-dom
"
;
import
roomApi
from
"
../../apis/room.api
"
;
const
INIT_ROOM
=
{
id
:
""
,
name
:
""
,
profileimg
:
""
,
};
const
InitRoom
=
()
=>
{
const
{
roomId
}
=
useParams
();
const
[
room
,
setRoom
]
=
useState
(
INIT_ROOM
);
const
[
error
,
setError
]
=
useState
(
""
);
async
function
getRoom
(
roomId
)
{
console
.
log
(
roomId
)
try
{
const
data
=
await
roomApi
.
getRoom
([
roomId
]);
setRoom
(
data
[
0
]);
}
catch
(
error
)
{
catchErrors
(
error
,
setError
);
}
}
console
.
log
(
room
)
useEffect
(()
=>
{
console
.
log
(
'
roomId확인
'
,
roomId
)
getRoom
(
roomId
);
},
[
roomId
]);
return
(
<
div
>
<
div
style
=
{{
backgroundColor
:
"
#262626
"
,
width
:
"
auto
"
,
height
:
"
2px
"
}}
/
>
<
form
className
=
"
flex-row align-items-center justify-content-center m-5
"
>
<
div
className
=
"
d-flex justify-content-center
"
>
<
img
src
=
{
`/roomUploads/
${
room
.
profileimg
}
`
}
className
=
"
rounded-circle
"
style
=
{{
width
:
"
250px
"
,
height
:
"
250px
"
,
}}
/
>
<
/div
>
<
div
className
=
"
d-flex justify-content-center mt-3
"
>
<
div
>
<
div
className
=
"
row
"
>
<
h6
className
=
"
col
"
style
=
{{
text
:
'
center
'
}}
>
방이름
<
/h6
>
<
h4
className
=
"
col
"
>
{
room
.
name
}
<
/h4
>
<
/div
>
<
div
className
=
"
row
"
>
<
h6
className
=
"
col
"
>
방코드
<
/h6
>
<
h4
className
=
"
col
"
>
{
room
.
id
}
<
/h4
>
<
/div
>
<
/div
>
<
/div
>
<
/form
>
<
/div
>
);
};
export
default
InitRoom
;
client/src/components/Room/LeftHamburger.js
View file @
043dc302
...
@@ -23,18 +23,18 @@ const LeftHamberger = () => {
...
@@ -23,18 +23,18 @@ const LeftHamberger = () => {
const
[
error
,
setError
]
=
useState
(
""
);
const
[
error
,
setError
]
=
useState
(
""
);
async
function
getChannel
(
roomId
)
{
async
function
getChannel
(
roomId
)
{
console
.
log
(
'
roomId
'
,
roomId
)
//
console.log('roomId', 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
[
0
])
//
console.log('방데이터:', Channel[0])
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
]
...
@@ -46,10 +46,10 @@ const LeftHamberger = () => {
...
@@ -46,10 +46,10 @@ const LeftHamberger = () => {
catchErrors
(
error
,
setError
);
catchErrors
(
error
,
setError
);
}
}
}
}
console
.
log
(
channel
)
//
console.log(channel)
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'
roomId
'
,
roomId
)
//
console.log('roomId', roomId)
getChannel
(
roomId
);
getChannel
(
roomId
);
},
[
roomId
]);
},
[
roomId
]);
...
...
client/src/components/Room/RightHamburger.js
View file @
043dc302
...
@@ -16,18 +16,18 @@ const RightHamburger = () => {
...
@@ -16,18 +16,18 @@ const RightHamburger = () => {
const
[
error
,
setError
]
=
useState
(
""
);
const
[
error
,
setError
]
=
useState
(
""
);
async
function
getChannel
(
roomId
)
{
async
function
getChannel
(
roomId
)
{
console
.
log
(
'
roomId
'
,
roomId
)
//
console.log('roomId', 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
]
...
@@ -39,10 +39,10 @@ const RightHamburger = () => {
...
@@ -39,10 +39,10 @@ const RightHamburger = () => {
catchErrors
(
error
,
setError
);
catchErrors
(
error
,
setError
);
}
}
}
}
console
.
log
(
channel
)
//
console.log(channel)
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'
roomId
'
,
roomId
)
//
console.log('roomId', roomId)
getChannel
(
roomId
);
getChannel
(
roomId
);
},
[
roomId
]);
},
[
roomId
]);
return
(
return
(
...
...
client/src/pages/InitRoomPage.js
0 → 100644
View file @
043dc302
import
ChannelList
from
'
../components/Room/ChannelList
'
import
InitRoom
from
'
../components/Room/InitRoom
'
const
InitRoomPage
=
()
=>
{
return
(
<
div
>
<
ChannelList
/>
<
InitRoom
/>
<
/div
>
)
}
export
default
InitRoomPage
index.js
View file @
043dc302
...
@@ -28,7 +28,7 @@ sequelize
...
@@ -28,7 +28,7 @@ sequelize
name
:
"
room
"
,
name
:
"
room
"
,
owner
:
8888
,
owner
:
8888
,
member
:
[
8888
],
member
:
[
8888
],
profileimg
:
"
ef0930f6be18ce73380d952337a6de1f
"
,
profileimg
:
"
defaultimg
"
,
});
});
await
Room
.
create
({
await
Room
.
create
({
...
@@ -36,7 +36,7 @@ sequelize
...
@@ -36,7 +36,7 @@ sequelize
name
:
"
room1
"
,
name
:
"
room1
"
,
owner
:
9999
,
owner
:
9999
,
member
:
[
9999
],
member
:
[
9999
],
profileimg
:
"
ef0930f6be18ce73380d952337a6de1f
"
,
profileimg
:
"
defaultimg
"
,
});
});
app
.
listen
(
appConfig
.
port
,
()
=>
{
app
.
listen
(
appConfig
.
port
,
()
=>
{
...
...
roomUploads/defaultimg
0 → 100644
View file @
043dc302
File added
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