Make Donations reactive

Co-authored-by: @alina-beck <alina.beck@mail.com>
This commit is contained in:
mattwr18 2019-11-12 13:26:30 +01:00
parent 982a02fc4f
commit a215093bc3
4 changed files with 4 additions and 5 deletions

View File

@ -1,13 +1,9 @@
import uuid from 'uuid/v4'
export default {
Mutation: {
UpdateDonations: async (_parent, params, context, _resolveInfo) => {
const { driver } = context
const session = driver.session()
let donations
params.id = params.id || uuid()
const writeTxResultPromise = session.writeTransaction(async txc => {
const updateDonationsTransactionResponse = await txc.run(
`

View File

@ -12,6 +12,7 @@ const driver = getDriver()
const updateDonationsMutation = gql`
mutation($goal: Int, $progress: Int) {
UpdateDonations(goal: $goal, progress: $progress) {
id
goal
progress
createdAt
@ -22,6 +23,7 @@ const updateDonationsMutation = gql`
const donationsQuery = gql`
query {
Donations {
id
goal
progress
}

View File

@ -3,6 +3,7 @@ import gql from 'graphql-tag'
export const DonationsQuery = () => gql`
query {
Donations {
id
goal
progress
}

View File

@ -49,7 +49,7 @@ export default {
query() {
return DonationsQuery()
},
result({ data: { Donations } }) {
update({ Donations }) {
const { goal, progress } = Donations[0]
this.formData = {
goal,