Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-05-28 16:16:40 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d90d1f3e9f58d5bd82a0dfe00a31e349a473d570
d90d1f3e
1 parent
3cf5d277
move useQuery to RoomPresenter
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
front/src/Routes/Room/RoomContainer.js
front/src/Routes/Room/RoomPresenter.js
front/src/Routes/Room/RoomContainer.js
View file @
d90d1f3
import
React
,
{
useState
}
from
"react"
;
import
{
use
Query
,
use
Mutation
}
from
"@apollo/react-hooks"
;
import
{
useMutation
}
from
"@apollo/react-hooks"
;
import
{
withRouter
}
from
"react-router-dom"
;
import
RoomPresenter
from
"./RoomPresenter"
;
import
{
GET_ROOMS
,
CREATE_ROOM
}
from
"./RoomQueries"
;
import
{
CREATE_ROOM
}
from
"./RoomQueries"
;
import
useInput
from
"../../Hooks/useInput"
;
import
{
toast
}
from
"react-toastify"
;
...
...
@@ -11,14 +11,9 @@ export default withRouter(() => {
const
roomName
=
useInput
(
""
);
const
{
data
}
=
useQuery
(
GET_ROOMS
);
const
[
createRoom
]
=
useMutation
(
CREATE_ROOM
);
let
roomArray
,
newRoomObj
;
if
(
data
!==
undefined
)
{
const
{
getRooms
}
=
data
;
roomArray
=
getRooms
;
}
let
newRoomObj
;
const
onSubmit
=
async
(
e
)
=>
{
e
.
preventDefault
();
...
...
@@ -43,7 +38,6 @@ export default withRouter(() => {
return
(
<
RoomPresenter
roomArray
=
{
roomArray
}
action
=
{
action
}
setAction
=
{
setAction
}
onSubmit
=
{
onSubmit
}
...
...
front/src/Routes/Room/RoomPresenter.js
View file @
d90d1f3
...
...
@@ -6,6 +6,8 @@ import { Link } from "react-router-dom";
import
Header
from
"../../Components/Header"
;
import
Input
from
"../../Components/Input"
;
import
Button
from
"../../Components/Button"
;
import
{
useQuery
}
from
"@apollo/react-hooks"
;
import
{
GET_ROOMS
}
from
"./RoomQueries"
;
const
Wrapper
=
styled
.
div
`
display: flex;
...
...
@@ -85,7 +87,7 @@ const RoomContainer = styled.div`
flex-direction: column;
width: 100%;
overflow-y: scroll;
m
in-height: 70
px;
m
ax-height: 85
px;
justify-content: center;
align-items: center;
&::-webkit-scrollbar {
...
...
@@ -134,6 +136,9 @@ const StyledLink = styled(Link)`
text-decoration: none;
cursor: pointer;
color: #079992;
&:not(:last-child) {
margin-bottom: 10px;
}
svg {
color: #079992;
&:hover {
...
...
@@ -153,7 +158,15 @@ const StyledLink = styled(Link)`
}
`
;
export
default
({
roomArray
,
action
,
setAction
,
onSubmit
,
roomName
})
=>
{
export
default
({
action
,
setAction
,
onSubmit
,
roomName
})
=>
{
const
{
data
}
=
useQuery
(
GET_ROOMS
);
let
roomArray
;
if
(
data
!==
undefined
)
{
const
{
getRooms
}
=
data
;
roomArray
=
getRooms
;
}
return
(
<
Wrapper
>
<
Header
text
=
{
"KhuChat"
}
><
/Header
>
...
...
Please
register
or
login
to post a comment