mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Make Donations reactive
Co-authored-by: @alina-beck <alina.beck@mail.com>
This commit is contained in:
parent
982a02fc4f
commit
a215093bc3
@ -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(
|
||||
`
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import gql from 'graphql-tag'
|
||||
export const DonationsQuery = () => gql`
|
||||
query {
|
||||
Donations {
|
||||
id
|
||||
goal
|
||||
progress
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ export default {
|
||||
query() {
|
||||
return DonationsQuery()
|
||||
},
|
||||
result({ data: { Donations } }) {
|
||||
update({ Donations }) {
|
||||
const { goal, progress } = Donations[0]
|
||||
this.formData = {
|
||||
goal,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user