Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return previousContext;
}
});
const errorLink = onError(({ graphQLErrors, networkError }) => {
if (graphQLErrors)
graphQLErrors.map(({ message, locations, path }) =>
console.log(
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
)
);
if (networkError) console.log(`[Network error]: ${networkError}`);
});
AWS.config.update({ region: "eu-west-1" });
const appSyncLink = createAppSyncLink({
url:
process.env.NODE_ENV === "development"
? process.env.REACT_APP_LOCAL_APPSYNC_URL
: "https://vipqqwuxvfdn7gaos7u4aav3su.appsync-api.eu-west-1.amazonaws.com/graphql",
region: "eu-west-1",
auth: {
type: AUTH_TYPE.AWS_IAM,
credentials: new AWS.CognitoIdentityCredentials({
IdentityPoolId: "eu-west-1:dffe4e03-9e89-4118-911f-ee327e257d9f"
})
}
});
const link = ApolloLink.from([authLink, errorLink, appSyncLink]);
const client = new AWSAppSyncClient({ disableOffline: true }, { link });