Fix add/delete admins

master
Max 5 years ago
parent 085d90114c
commit cb35d79fe2

@ -209,11 +209,15 @@ export class GroupComponent implements OnInit {
}
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) {
this.groupService.removeGroupAdmin(user.userID.toString(), this.id).subscribe();
this.groupService.removeGroupAdmin(user.userID.toString(), this.id).subscribe(response => {
user.isGroupAdmin = false;
});
}
openPfpLightbox() {

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

Loading…
Cancel
Save