diff --git a/src/app/components/group/group.component.html b/src/app/components/group/group.component.html index a903837..7022283 100644 --- a/src/app/components/group/group.component.html +++ b/src/app/components/group/group.component.html @@ -13,13 +13,19 @@ {{groupProfile.name}}
- + + - +
+ diff --git a/src/app/components/social/groups/groups.component.ts b/src/app/components/social/groups/groups.component.ts index d5f1c25..bcb87cf 100644 --- a/src/app/components/social/groups/groups.component.ts +++ b/src/app/components/social/groups/groups.component.ts @@ -75,5 +75,9 @@ export class GroupsComponent implements OnInit { deleteGroup(group: GroupInfo) { this.groupService.deleteGroup(group.id).subscribe(); } + + leaveGroup(group: GroupInfo) { + this.groupService.leaveGroup(group.id).subscribe(); + } } diff --git a/src/app/services/group/group.service.ts b/src/app/services/group/group.service.ts index 907de7e..48beabd 100644 --- a/src/app/services/group/group.service.ts +++ b/src/app/services/group/group.service.ts @@ -131,4 +131,18 @@ export class GroupService extends BaseService { this.data.deleteGroup(groupId); })); } + + public leaveGroup(groupId: number) { + const body = { + query: `mutation($groupId: ID!) { + leaveGroup(groupId: $groupId){ id } + }`, variables: { + groupId + } + }; + return this.postGraphql(body) + .pipe(tap(response => { + this.data.deleteGroup(groupId); + })); + } }