Added creation of groups

This commit is contained in:
2026-04-25 18:14:10 +01:00
parent 3e6aae68d2
commit 99b4e0ea35
7 changed files with 264 additions and 118 deletions
+5 -36
View File
@@ -1,7 +1,6 @@
import {Component, inject, OnInit, signal} from '@angular/core';
import {IonicModule, LoadingController, ToastController} from "@ionic/angular";
import {GetGroupDto, GroupsService} from "../../services/api";
import {firstValueFrom} from "rxjs";
import {Component, input} from '@angular/core';
import {IonicModule} from "@ionic/angular";
import {GetGroupDto} from "../../services/api";
import {addIcons} from "ionicons";
import {chatbubblesOutline, chevronForwardOutline} from "ionicons/icons";
@@ -18,36 +17,6 @@ addIcons({
IonicModule
]
})
export class GroupsComponent implements OnInit {
private groupsService = inject(GroupsService);
private toastCtrl = inject(ToastController);
private loadCtrl = inject(LoadingController);
groups = signal<GetGroupDto[]>([]);
async ngOnInit() {
await this.fetchGroups();
}
async fetchGroups() {
const loading = await this.loadCtrl.create({
message: 'Chargement...',
spinner: 'lines-sharp-small'
});
await loading.present();
try {
const groups = await firstValueFrom(this.groupsService.getAllGroupsEndpoint());
this.groups.set(groups);
}
catch {
const toast = await this.toastCtrl.create({
message: 'Impossible de charger les groupes du joueur',
duration: 2000,
color: 'danger'
});
await toast.present();
}
await loading.dismiss();
}
export class GroupsComponent {
groups = input.required<GetGroupDto[]>();
}