Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { withAuthenticator } from 'aws-amplify-react';
import AWSAppSyncClient from 'aws-appsync';
import { Rehydrated } from 'aws-appsync-react';
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link';
import { Component } from 'react';
import { ApolloProvider } from 'react-apollo';
import Roundtrip from './Roundtrip';
const client = new AWSAppSyncClient({
url: 'http://localhost:62222/graphql',
// url:
// 'https://sgdhr5dvovavfa6frgekxw3fi4.appsync-api.us-east-1.amazonaws.com/graphql',
region: 'us-east-1',
disableOffline: true,
auth: {
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
jwtToken: async () =>
(await Auth.currentSession()).getIdToken().getJwtToken(),
},
});
console.log('>>> START');
Amplify.configure({
Auth: {
userPoolId: 'us-east-1_27WcML9k8',
userPoolWebClientId: 'q4ppu404sdiqlcjg21756hvap',
region: 'us-east-1',
},
});
class App extends Component {
render() {
import Search from './routes/Search';
import { Footer } from './components/helpers';
Amplify.configure({
Auth: {
region: process.env.REACT_APP_AWS_AUTH_REGION, // REQUIRED - Amazon Cognito Region
userPoolId: process.env.REACT_APP_USER_POOL_ID, // OPTIONAL - Amazon Cognito User Pool ID
userPoolWebClientId: process.env.REACT_APP_CLIENT_APP_ID, // User Pool App Client ID
},
});
const client = new AWSAppSyncClient({
url: process.env.REACT_APP_GRAPHQL_ENDPOINT,
region: process.env.REACT_APP_AWS_CLIENT_REGION,
auth: {
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
jwtToken: async () =>
(await Auth.currentSession()).getIdToken().getJwtToken(),
},
});
const WithProvider = () => (
<footer>
Home
<span> | </span>
Search</footer>
constructor() {
const client = new AWSAppSyncClient({
url: aws_exports.aws_appsync_graphqlEndpoint,
region: aws_exports.aws_project_region,
auth: {
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken()
}
});
// this.hc = client.hydrated;
this._hc = client;
}
hc() {
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 = () => (
);
export default App;