Last active
October 4, 2020 01:04
-
-
Save imolorhe/b136ff38da437daa2a69327da5b60352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample file: https://github.com/clayton13/HeadsUpAngel/blob/3546992cf1c7ffc2b0db04b915b87cba58b19d0f/src/aws-exports.js | |
var config = { | |
APIKEY: 'key', | |
REGION: 'us-west-2', | |
TYPE: 'API_KEY', | |
ENDPOINT: 'endpoint', | |
}; | |
export default config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment