-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
62 lines (44 loc) · 1.54 KB
/
App.js
File metadata and controls
62 lines (44 loc) · 1.54 KB
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
60
61
62
import React from 'react';
import { StyleSheet, Text, View, Button, Platform } from 'react-native';
import AWSAppSyncClient from "aws-appsync";
import { Rehydrated } from 'aws-appsync-react';
import { AUTH_TYPE } from "aws-appsync/lib/link/auth-link";
import { ApolloProvider } from 'react-apollo';
// import * as AWS from 'aws-sdk';
import awsconfig from './aws-exports';
import Route from './src/route'
import Amplify, { Auth } from 'aws-amplify'
import { withAuthenticator } from 'aws-amplify-react-native';
import AWSConfig from './aws-exports'
import AppSync from './AppSync'
Amplify.configure(AWSConfig)
//redux
import { Provider } from "react-redux";
import { applyMiddleware, createStore } from "redux";
import logger from "redux-logger";
import AppReducer from './src/reducers/'
const store = createStore(AppReducer, applyMiddleware(logger));
// console.disableYellowBox = true;
// const client = new AWSAppSyncClient({
// url: AppSync.graphqlEndpoint,
// region: AppSync.region,
// auth: {
// type: 'AMAZON_COGNITO_USER_POOLS',
// jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
// }
// });
const client = new AWSAppSyncClient({
url: AppSync.graphqlEndpoint,
region: AppSync.region,
auth: {type: AppSync.authenticationType, apiKey: AppSync.apiKey}
});
const App = () => (
<ApolloProvider client={client}>
<Provider store={store}>
<Rehydrated>
<Route />
</Rehydrated>
</Provider>
</ApolloProvider>
);
export default App