Fixed error with visibility of all groups after change

This commit is contained in:
2026-04-28 11:25:15 +01:00
parent a9e13c3af3
commit 9367f5e7b3
3 changed files with 16 additions and 4 deletions
@@ -1,4 +1,4 @@
import {Component, computed, inject, input, OnInit, signal} from '@angular/core';
import {Component, computed, inject, input, OnInit, output, signal} from '@angular/core';
import {GetGroupDetailsDto, GroupsService} from "../../services/api";
import {addIcons} from "ionicons";
import {peopleOutline, banOutline, arrowUpCircleOutline} from "ionicons/icons";
@@ -33,6 +33,8 @@ export class GroupInfoComponent implements OnInit {
date = computed<string>(() => moment(this.group().creationDate).format('DD/MM/YYYY'));
idGroup = output<number>();
options = [1, 2, 3];
ngOnInit() {
@@ -76,8 +78,11 @@ export class GroupInfoComponent implements OnInit {
});
await loading.present();
const oldGroup = this.group().id;
try {
await firstValueFrom(this.groupsService.leaveGroupEndpoint(this.group().id));
await firstValueFrom(this.groupsService.leaveGroupEndpoint(oldGroup));
this.idGroup.emit(oldGroup);
const toast = await this.toastCtrl.create({
message: 'Vous avez quitter ce groupe',
duration: 2000,
@@ -105,8 +110,11 @@ export class GroupInfoComponent implements OnInit {
});
await loading.present();
const oldGroup = this.group().id;
try {
await firstValueFrom(this.groupsService.deleteGroupEndpoint(this.group().id));
await firstValueFrom(this.groupsService.deleteGroupEndpoint(oldGroup));
this.idGroup.emit(oldGroup);
const toast = await this.toastCtrl.create({
message: 'Groupe supprimé',
duration: 2000,
+1 -1
View File
@@ -158,7 +158,7 @@
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding" style="--background: #f7f6f2;">
<app-group-info [groupSelected]="groupSelected()"></app-group-info>
<app-group-info (idGroup)="removeGroup($event)" [groupSelected]="groupSelected()"></app-group-info>
</ion-content>
</ng-template>
</ion-modal>
+4
View File
@@ -149,4 +149,8 @@ export class HomeComponent implements OnInit {
this.groupSelected.set(null);
await this.navCtrl.navigateRoot('/home');
}
removeGroup(groupId: number) {
this.groups.update(x => x.filter(g => g.id !== groupId));
}
}