Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import Amplify, { API, graphqlOperation } from "aws-amplify";
  2. // import API from '@aws-amplify/api';
  3. import awsconfig from './aws-exports';
  4.  
  5. Amplify.configure(awsconfig) // *not sure
  6. API.configure(awsconfig);
  7.  
  8. // Subscribe to creation of Todo
  9. const SubscribeToEventComments = `subscription subscribeToComments {
  10. subscribeToComments {
  11. commentId
  12. content
  13. }
  14. }`;
  15.  
  16. const subscription = API.graphql({
  17. query: SubscribeToEventComments,
  18. variables: {}
  19. }).subscribe({
  20. next: (eventData) => console.log(eventData)
  21. });
  22.  
  23. // Stop receiving data updates from the subscription
  24. subscription.unsubscribe();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement