Skip to content

Instantly share code, notes, and snippets.

@LazyFatArrow
Last active May 27, 2019 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LazyFatArrow/736c7fafe867accdaf0fb1c099f0b74c to your computer and use it in GitHub Desktop.
Save LazyFatArrow/736c7fafe867accdaf0fb1c099f0b74c to your computer and use it in GitHub Desktop.
<template>
<!-- ... html -->
<SinglePoll
v-for="poll in polls"
@optionVote="handleOptionVote"
:key="`poll-${poll.id}`"
:poll="poll"
/>
<!-- ... more html -->
</template>
<script>
import { POLLS } from '@/gql/queries/poll.queries'
import { VOTE_ON_POLL } from '@/gql/mutations/poll.mutations'
import SinglePoll from '@/components/SinglePoll.vue'
export default {
// ... code
methods: {
handleOptionVote(optionId) {
this.$apollo.mutate({
mutation: VOTE_ON_POLL,
variables: {
optionId
}
})
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment