Allow to leave directly from the group

- Also handle error when you are the last admin
- Also change order from the dropdown menu

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-05-25 18:36:11 +02:00
parent 6e59c2cb95
commit 7e1409100f
2 changed files with 66 additions and 21 deletions

View File

@@ -139,22 +139,28 @@ export default class MyGroups extends Vue {
}
async leaveGroup(group: IGroup): Promise<void> {
const { page, limit } = this;
await this.$apollo.mutate({
mutation: LEAVE_GROUP,
variables: {
groupId: group.id,
},
refetchQueries: [
{
query: LOGGED_USER_MEMBERSHIPS,
variables: {
page,
limit,
},
try {
const { page, limit } = this;
await this.$apollo.mutate({
mutation: LEAVE_GROUP,
variables: {
groupId: group.id,
},
],
});
refetchQueries: [
{
query: LOGGED_USER_MEMBERSHIPS,
variables: {
page,
limit,
},
},
],
});
} catch (error) {
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);
}
}
}
get invitations(): IMember[] {