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-07-25 17:24:09 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6c6390a033dbe1c5ed283457ca0dd7fcdb38978e
6c6390a0
1 parent
e9299fc7
add useQuery, @client query.
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletions
front/src/Routes/MainPresenter.js
front/src/Routes/MainPresenter.js
View file @
6c6390a
...
...
@@ -2,11 +2,31 @@ import React from "react";
import
Header
from
"../Components/Header"
;
import
Main
from
"../Components/Main"
;
import
Footer
from
"../Components/Footer"
;
import
{
gql
}
from
"@apollo/client"
;
import
{
useQuery
}
from
"@apollo/react-hooks"
;
const
checkLogin
=
gql
`
{
isLoggedIn @client
}
`
;
export
default
()
=>
{
const
{
data
:
{
isLoggedIn
},
}
=
useQuery
(
checkLogin
);
let
btnState
;
if
(
isLoggedIn
)
{
btnState
=
"roomlist"
;
}
else
{
btnState
=
"main"
;
}
return
(
<>
<
Header
/>
<
Header
btnStateProp
=
{
btnState
}
/
>
<
Main
/>
<
Footer
/>
<
/
>
...
...
Please
register
or
login
to post a comment