Last active
May 27, 2019 23:41
-
-
Save LazyFatArrow/736c7fafe867accdaf0fb1c099f0b74c 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
<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