mattwr18 f51ad1131b UpdateDonations from admin/donations
@alina-beck I'm not 100% satisfied with this at the moment. I think that
the admin could have the goal and progress initialized from a query for
the Donations, and be able to update if one of them changed... what do
you think?
2019-11-11 19:16:07 +01:00

49 lines
1.1 KiB
Vue

<template>
<ds-card :header="$t('admin.donations.name')">
<ds-form v-model="formData" @submit="submit">
<ds-input model="goal" :label="$t('admin.donations.goal')" placeholder="15000" icon="money" />
<ds-input
model="progress"
:label="$t('admin.donations.progress')"
placeholder="1200"
icon="money"
/>
<ds-button primary type="submit" :disabled="!formData.goal || !formData.progress">
{{ $t('actions.save') }}
</ds-button>
</ds-form>
</ds-card>
</template>
<script>
import { UpdateDonations } from '~/graphql/Donations'
export default {
data() {
return {
formData: {
goal: null,
progress: null,
},
}
},
methods: {
submit() {
const { goal, progress } = this
this.$apollo
.mutate({
mutation: UpdateDonations(),
variables: {
goal,
progress,
},
})
.then(() => {
this.$toast.success('yay!!')
})
.catch(error => this.$toast.error(error.message))
},
},
}
</script>