Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Amplify, { API, graphqlOperation } from "aws-amplify";
- // import API from '@aws-amplify/api';
- import awsconfig from './aws-exports';
- Amplify.configure(awsconfig) // *not sure
- API.configure(awsconfig);
- // Subscribe to creation of Todo
- const SubscribeToEventComments = `subscription subscribeToComments {
- subscribeToComments {
- commentId
- content
- }
- }`;
- const subscription = API.graphql({
- query: SubscribeToEventComments,
- variables: {}
- }).subscribe({
- next: (eventData) => console.log(eventData)
- });
- // Stop receiving data updates from the subscription
- subscription.unsubscribe();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement