Slide 13
Slide 13 text
h
"NB[PO8FC4FSWJDFT
*ODPSJUT"GGJMJBUFT"MMSJHIUTSFTFSWFE
-BNCEBַךNVUBUJPO
const gql = require('graphql-tag');
// Set up mutation
const newVote = gql(`
mutation NewVote {
updateVoteCount(input:
{Finalist: "${Finalist}"}){
Finalist, Votes
}
}
`);
// Set up Apollo client
const client = new AWSAppSyncClient({
url: url,
region: region,
auth: {
type: type,
credentials: AWS.config.credentials,
},
disableOffline: true
});
try {
const newVoteResult = await client.mutate({
variables: {
type: "variables",
},
mutation: newVote,
});
callback(null, {
newVoteResult: newVoteResult,
});
} catch (err) {
callback(err);
}