-
Notifications
You must be signed in to change notification settings - Fork 16
/
App.js
30 lines (26 loc) · 880 Bytes
/
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
import React from 'react';
import Amplify, { Auth } from 'aws-amplify';
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 awsConfig from './app/aws-exports';
import appSyncConfig from './app/aws-appsync';
import MainNavigator from './app/routes/MainNavigator';
Amplify.configure(awsConfig);
const appSyncClient = new AWSAppSyncClient({
url: appSyncConfig.graphqlEndpoint,
region: appSyncConfig.region,
auth: {
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
},
});
const App = () => (
<ApolloProvider client={appSyncClient}>
<Rehydrated>
<MainNavigator />
</Rehydrated>
</ApolloProvider>
);
export default App;