Skip to content

Commit 0e9882f

Browse files
Add apollo provider
1 parent 0cf1ffd commit 0e9882f

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/App.tsx

+23-13
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,33 @@ import { BrowserRouter, Route, Switch } from "react-router-dom";
44
import Menu from "./components/menu/Menu";
55
import About from "./pages/about/About";
66
import ManageTasks from "./pages/manageTasks/ManageTasks";
7+
import { ApolloProvider } from "react-apollo";
8+
import { ApolloClient } from "apollo-client";
9+
import { InMemoryCache } from "apollo-cache-inmemory";
10+
import { createHttpLink } from "apollo-link-http";
711

812
class App extends Component {
13+
client = new ApolloClient({
14+
link: createHttpLink({ uri: "http://localhost:4000/graphql" }),
15+
cache: new InMemoryCache()
16+
});
917
render() {
1018
return (
11-
<BrowserRouter>
12-
<IonApp>
13-
<IonSplitPane contentId="main">
14-
<Menu />
15-
<IonPage id="main">
16-
<Switch>
17-
<Route path="/" component={ManageTasks} />
18-
<Route path="tasks" component={About} />
19-
</Switch>
20-
</IonPage>
21-
</IonSplitPane>
22-
</IonApp>
23-
</BrowserRouter>
19+
<ApolloProvider client={this.client}>
20+
<BrowserRouter>
21+
<IonApp>
22+
<IonSplitPane contentId="main">
23+
<Menu />
24+
<IonPage id="main">
25+
<Switch>
26+
<Route path="/" component={ManageTasks} />
27+
<Route path="tasks" component={About} />
28+
</Switch>
29+
</IonPage>
30+
</IonSplitPane>
31+
</IonApp>
32+
</BrowserRouter>
33+
</ApolloProvider>
2434
);
2535
}
2636
}

0 commit comments

Comments
 (0)