Wolfgang Huß 6df10e5588 Refactor 'updateGroupMutation' to a function that returns GQL
- Add and refactor some tests for the user resolvers.
- Refactor minor in general.
2022-09-18 08:35:31 +02:00

41 lines
948 B
Vue

<template>
<div>
<ds-container>
<group-form :group="group" :update="true" @updateGroup="updateGroup" />
</ds-container>
</div>
</template>
<script>
import GroupForm from '~/components/Group/GroupForm'
import { updateGroupMutation } from '~/graphql/groups.js'
export default {
components: {
GroupForm,
},
props: {
group: {
type: Object,
required: false,
default: () => ({}),
},
},
methods: {
async updateGroup(value) {
const { id, name, about, description, groupType, actionRadius, categoryIds } = value
const variables = { id, name, about, description, groupType, actionRadius, categoryIds }
try {
await this.$apollo.mutate({
mutation: updateGroupMutation(),
variables,
})
this.$toast.success(this.$t('group.group-updated'))
} catch (error) {
this.$toast.error(error.message)
}
},
},
}
</script>