-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
59 lines (54 loc) · 1.81 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React from 'react';
import { ApolloProvider, ApolloClient, InMemoryCache } from '@apollo/client';
import {
BrowserRouter as Router,
Switch,
Route
} from "react-router-dom";
import AddTvSeriesPage from './Pages/AddTvSeriesPage/AddTvSeriesPage';
import NavigationButton from './Pages/common/NavigationButton';
import TvSeriesesPage from './Pages/TvSeriesesPage/TvSeriesesPage';
import TvSeriesPage from './Pages/TvSeriesPage/TvSeriesPage';
import RouteNotFound from './Pages/RouteNotFound';
import { routerRoutes } from './Utils/Utils';
import './App.css';
const SERVER_API_URL = 'http://localhost:4000/graphql';
const apolloClient = new ApolloClient({
uri: SERVER_API_URL,
cache: new InMemoryCache()
});
function App() {
return (
<Router>
<ApolloProvider client={apolloClient}>
<div className="App">
<header className="AppHeader">
<div className="AppHeaderTitles">
<h1>Best TV Shows That Ended</h1>
<h2>{"Popularity & Years on Air"}</h2>
</div>
<div className="navigationButtons">
<NavigationButton pageTitle="Home" pageRoute={routerRoutes.home} />
<NavigationButton pageTitle="Add TV Series" pageRoute={routerRoutes.addTvSeries} />
</div>
</header>
<Switch>
<Route exact path={routerRoutes.home}>
<TvSeriesesPage />
</Route>
<Route exact path={routerRoutes.addTvSeries}>
<AddTvSeriesPage />
</Route>
<Route path={`${routerRoutes.tvSeries}/:tvSeriesTitle`}>
<TvSeriesPage />
</Route>
<Route path="*">
<RouteNotFound />
</Route>
</Switch>
</div>
</ApolloProvider>
</Router>
);
}
export default App;