Fix 'groupQuery' GQL on group edit page

- Fix links 'group/my-groups' to 'my-groups'.
- Fix 'createGroupMutation' to be used as a function on group create page.
This commit is contained in:
Wolfgang Huß 2022-09-18 19:44:40 +02:00
parent bba4ca0fc6
commit c2f7604918
4 changed files with 5 additions and 5 deletions

View File

@ -60,7 +60,7 @@
</ds-space> </ds-space>
</ds-form> </ds-form>
<ds-space centered v-show="!update"> <ds-space centered v-show="!update">
<nuxt-link to="/group/my-groups">zurück</nuxt-link> <nuxt-link to="/my-groups">zurück</nuxt-link>
</ds-space> </ds-space>
</ds-container> </ds-container>
</div> </div>

View File

@ -143,7 +143,7 @@ export const changeGroupMemberRoleMutation = () => {
// ------ queries // ------ queries
export const groupQuery = (i18n) => { export const groupQuery = (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n ? i18n.locale().toUpperCase() : 'EN'
return gql` return gql`
query ($isMember: Boolean, $id: ID, $slug: String) { query ($isMember: Boolean, $id: ID, $slug: String) {
Group(isMember: $isMember, id: $id, slug: $slug) { Group(isMember: $isMember, id: $id, slug: $slug) {

View File

@ -33,7 +33,7 @@ export default {
const variables = { name, about, description, groupType, actionRadius, categoryIds } const variables = { name, about, description, groupType, actionRadius, categoryIds }
try { try {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: createGroupMutation, mutation: createGroupMutation(),
variables, variables,
}) })
this.$toast.success(this.$t('group.group-created')) this.$toast.success(this.$t('group.group-created'))

View File

@ -12,7 +12,7 @@
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
<ds-space centered> <ds-space centered>
<nuxt-link to="/group/my-groups">zurück</nuxt-link> <nuxt-link to="/my-groups">zurück</nuxt-link>
</ds-space> </ds-space>
</div> </div>
</template> </template>
@ -51,7 +51,7 @@ export default {
Group: [group], Group: [group],
}, },
} = await client.query({ } = await client.query({
query: groupQuery(this.$i18n), query: groupQuery(), // "this.$i18n" is undefined here, so we use default lang
variables: { id }, variables: { id },
}) })
if (group.myRole !== 'owner') { if (group.myRole !== 'owner') {