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 {
|
export default {
|
||||||
Mutation: {
|
Mutation: {
|
||||||
UpdateDonations: async (_parent, params, context, _resolveInfo) => {
|
UpdateDonations: async (_parent, params, context, _resolveInfo) => {
|
||||||
const { driver } = context
|
const { driver } = context
|
||||||
const session = driver.session()
|
const session = driver.session()
|
||||||
let donations
|
let donations
|
||||||
params.id = params.id || uuid()
|
|
||||||
|
|
||||||
const writeTxResultPromise = session.writeTransaction(async txc => {
|
const writeTxResultPromise = session.writeTransaction(async txc => {
|
||||||
const updateDonationsTransactionResponse = await txc.run(
|
const updateDonationsTransactionResponse = await txc.run(
|
||||||
`
|
`
|
||||||
|
|||||||
@ -12,6 +12,7 @@ const driver = getDriver()
|
|||||||
const updateDonationsMutation = gql`
|
const updateDonationsMutation = gql`
|
||||||
mutation($goal: Int, $progress: Int) {
|
mutation($goal: Int, $progress: Int) {
|
||||||
UpdateDonations(goal: $goal, progress: $progress) {
|
UpdateDonations(goal: $goal, progress: $progress) {
|
||||||
|
id
|
||||||
goal
|
goal
|
||||||
progress
|
progress
|
||||||
createdAt
|
createdAt
|
||||||
@ -22,6 +23,7 @@ const updateDonationsMutation = gql`
|
|||||||
const donationsQuery = gql`
|
const donationsQuery = gql`
|
||||||
query {
|
query {
|
||||||
Donations {
|
Donations {
|
||||||
|
id
|
||||||
goal
|
goal
|
||||||
progress
|
progress
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import gql from 'graphql-tag'
|
|||||||
export const DonationsQuery = () => gql`
|
export const DonationsQuery = () => gql`
|
||||||
query {
|
query {
|
||||||
Donations {
|
Donations {
|
||||||
|
id
|
||||||
goal
|
goal
|
||||||
progress
|
progress
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ export default {
|
|||||||
query() {
|
query() {
|
||||||
return DonationsQuery()
|
return DonationsQuery()
|
||||||
},
|
},
|
||||||
result({ data: { Donations } }) {
|
update({ Donations }) {
|
||||||
const { goal, progress } = Donations[0]
|
const { goal, progress } = Donations[0]
|
||||||
this.formData = {
|
this.formData = {
|
||||||
goal,
|
goal,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user