Ocelot-Social/webapp/pages/my-groups.vue
Wolfgang Huß 6f6dc4e7fd Refactor 'groupMembersQuery' to a function that returns GQL
- Toast some Apollo GQL error messages
2022-09-18 17:51:26 +02:00

46 lines
941 B
Vue

<template>
<div>
<div>my groups</div>
<group-teaser />
<br />
<br />
<group-card :items="responseGroupListQuery" />
</div>
</template>
<script>
import GroupTeaser from '~/components/Group/GroupTeaser.vue'
import GroupCard from '~/components/Group/GroupCard.vue'
import { groupQuery } from '~/graphql/groups.js'
export default {
name: 'MyGroups',
components: {
GroupTeaser,
GroupCard,
},
data() {
return {
responseGroupListQuery: [],
}
},
methods: {
async groupListQuery() {
try {
const response = await this.$apollo.query({
query: groupQuery(this.$i18n),
})
this.responseGroupListQuery = response.data.Group
} catch (error) {
this.responseGroupListQuery = []
this.$toast.error(error.message)
} finally {
this.pending = false
}
},
},
created() {
this.groupListQuery()
},
}
</script>