-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
51 lines (45 loc) · 1.23 KB
/
App.js
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
import React from "react";
import { createStore } from "redux";
import { Provider } from "react-redux";
import RootStack from "./navigator/AppNavigator";
import { NavigationContainer } from "@react-navigation/native";
import ApolloClient from "apollo-boost";
import { ApolloProvider } from "react-apollo";
// establishing the connection to the API.
const client = new ApolloClient({
uri: `https://graphql.contentful.com/content/v1/spaces/ldcl3ayg0mhx`,
credentials: "same-origin",
headers: {
Authorization: `Bearer 93f3808c25c1f5bdb95476ca8576c6eaa12b5587efb956efb242ceead7cb3840`,
},
});
const initialState = {
action: "closeMenu",
name: "",
};
const reducuer = (state = initialState, action) => {
switch (action.type) {
case "CLOSE_MENU":
return { action: "closeMenu" };
break;
case "OPEN_MENU":
return { action: "openMenu" };
break;
case "UPDATE_NAME":
return { name: action.name };
default:
return state;
break;
}
};
const store = createStore(reducuer);
const App = () => (
<ApolloProvider client={client}>
<Provider store={store}>
<NavigationContainer>
<RootStack />
</NavigationContainer>
</Provider>
</ApolloProvider>
);
export default App;