sdy

update App.js

1 import React from "react"; 1 import React from "react";
2 -import GlobalStyles from "../Styles/GlobalStyles"; 2 +import { gql } from "apollo-boost";
3 +import { useQuery } from "react-apollo-hooks";
3 import { ThemeProvider } from "styled-components"; 4 import { ThemeProvider } from "styled-components";
5 +import GlobalStyles from "../Styles/GlobalStyles";
4 import Theme from "../Styles/Theme"; 6 import Theme from "../Styles/Theme";
5 -import MenuBar from "./MenuList/MenuBar"; 7 +import Router from "../Routes/Router";
6 -import SubMenuBar from "./SubMenuList/SubMenuBar"; 8 +
7 -import MainScreen from "./Main/MainScreen"; 9 +const QUERY = gql`
10 + {
11 + isLoggedIn @client
12 + }
13 +`;
8 14
9 export default () => { 15 export default () => {
16 + const {
17 + data: { isLoggedIn },
18 + } = useQuery(QUERY);
19 +
10 return ( 20 return (
11 <ThemeProvider theme={Theme}> 21 <ThemeProvider theme={Theme}>
12 <> 22 <>
13 <GlobalStyles /> 23 <GlobalStyles />
14 - <MenuBar /> 24 + <Router isLoggedIn={isLoggedIn} />
15 - <SubMenuBar />
16 - <MainScreen />
17 </> 25 </>
18 </ThemeProvider> 26 </ThemeProvider>
19 ); 27 );
......