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> |
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> | |
<b-container v-if="polls && polls.length" class="my-5"> | |
<b-row> | |
<b-col> | |
<b-btn>Create Poll</b-btn> | |
</b-col> | |
</b-row> | |
<b-row class="mt-3"> | |
<b-col> | |
<b-card-group columns> |
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> | |
<b-card :title="poll.title" :sub-title="poll.description"> | |
<b-form-group> | |
<b-form-radio-group | |
:id="`poll-options-${poll.id}`" | |
stacked | |
> | |
<b-form-radio | |
v-for="option in poll.options" | |
:key="`option-${option.id}`" |
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> | |
<b-container v-if="polls && polls.length" class="my-5"> | |
<b-row> | |
<b-col> | |
<b-btn>Create Poll</b-btn> | |
</b-col> | |
</b-row> | |
<b-row class="mt-3"> | |
<b-col> | |
<b-card-group columns> |
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> | |
</template> | |
<script> | |
import { POLLS } from '@/gql/queries/poll.queries' | |
export default { | |
apollo: { | |
polls: { | |
query: POLLS, |
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 Vue from 'vue' | |
import Router from 'vue-router' | |
import Polls from './views/Polls.vue' | |
Vue.use(Router) | |
export default new Router({ | |
mode: 'history', | |
base: process.env.BASE_URL, |
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 gql from 'graphql-tag' | |
export const POLLS = gql` | |
query Polls { | |
polls { | |
id | |
title | |
description | |
options { | |
id |
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 Vue from 'vue' | |
import BootstrapVue from 'bootstrap-vue' | |
import App from './App.vue' | |
import router from './router' | |
import { createProvider } from './vue-apollo' | |
import 'bootstrap/dist/css/bootstrap.css' | |
import 'bootstrap-vue/dist/bootstrap-vue.css' |
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
type Subscription { | |
pollCreated: Poll | |
optionVoted: Option | |
} |
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
// ... imports | |
export default { | |
// ... queries | |
mutations: { | |
// ... createPoll | |
async voteOnPoll(parent, args) { | |
const poll = await pollService.voteOnPoll(args.optionId).catch(); |