Merge branch 'max_dev' of Software_Engineering_I/greenvironment-frontend into master

master
Max_ES 5 years ago committed by Gitea
commit b5123da8ab

@ -209,11 +209,15 @@ export class GroupComponent implements OnInit {
} }
addGroupAdmin(user: User) { addGroupAdmin(user: User) {
this.groupService.addGroupAdmin(user.userID.toString(), this.id).subscribe(); this.groupService.addGroupAdmin(user.userID.toString(), this.id).subscribe(response => {
user.isGroupAdmin = true;
});
} }
removeGroupAdmin(user: User) { removeGroupAdmin(user: User) {
this.groupService.removeGroupAdmin(user.userID.toString(), this.id).subscribe(); this.groupService.removeGroupAdmin(user.userID.toString(), this.id).subscribe(response => {
user.isGroupAdmin = false;
});
} }
openPfpLightbox() { openPfpLightbox() {

@ -98,7 +98,7 @@ export class GroupService extends BaseService {
return this.postGraphql(body, null, 0) return this.postGraphql(body, null, 0)
.pipe(tap(response => { .pipe(tap(response => {
const group = this.group.getValue(); const group = this.group.getValue();
group.updateAdmins(response.data.addGroupAdmin); group.updateAdmins(response.data.addGroupAdmin.admins);
this.group.next(group); this.group.next(group);
})); }));
} }
@ -114,10 +114,13 @@ export class GroupService extends BaseService {
groupId groupId
} }
}; };
const group = this.group.getValue();
group.admins = [];
this.group.next(group);
return this.postGraphql(body, null, 0) return this.postGraphql(body, null, 0)
.pipe(tap(response => { .pipe(tap(response => {
const group = this.group.getValue(); const group = this.group.getValue();
group.updateAdmins(response.data.removeGroupAdmin); group.updateAdmins(response.data.removeGroupAdmin.admins);
this.group.next(group); this.group.next(group);
})); }));
} }

Loading…
Cancel
Save