Skip to content

Instantly share code, notes, and snippets.

@LazyFatArrow LazyFatArrow/Polls.vue
Last active May 27, 2019

Embed
What would you like to do?
<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
You can’t perform that action at this time.