Added creation of groups
This commit is contained in:
@@ -37,6 +37,6 @@
|
|||||||
<div class="px-1">
|
<div class="px-1">
|
||||||
<div class="rounded-lg px-4 py-0.5 m-2 bg-white border border-gray-200">
|
<div class="rounded-lg px-4 py-0.5 m-2 bg-white border border-gray-200">
|
||||||
<p class="text-2xl font-black font-mono mb-0.5">{{ userInfo().getUserStatsDto.totalLikes }}</p>
|
<p class="text-2xl font-black font-mono mb-0.5">{{ userInfo().getUserStatsDto.totalLikes }}</p>
|
||||||
<p class="text-[11px] font-semibold font-mono text-gray-400 mt-0">Score global</p>
|
<p class="text-[11px] font-semibold font-mono text-gray-400 mt-0">Total de likes</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<div class="bg-white rounded-xl p-5 shadow-sm border border-gray-200">
|
||||||
|
<form [formGroup]="groupForm">
|
||||||
|
<ion-label class="text-xs text-gray-500 mb-1 block">
|
||||||
|
Nom du groupe
|
||||||
|
<ion-text color="danger">*</ion-text>
|
||||||
|
</ion-label>
|
||||||
|
<ion-item lines="none" class="rounded-xl border border-gray-200">
|
||||||
|
<ion-input placeholder="Nom de ton groupe"
|
||||||
|
[clearInput]="true"
|
||||||
|
formControlName="label"
|
||||||
|
class="text-gray-800">
|
||||||
|
</ion-input>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
|
<div class="space-y-3 mt-4 max-h-[50vh] overflow-y-auto">
|
||||||
|
<ion-label class="text-sm text-gray-500 block">
|
||||||
|
Ajouter des amis dans le groupe
|
||||||
|
</ion-label>
|
||||||
|
|
||||||
|
@for (friend of friends(); track friend.friendId) {
|
||||||
|
<ion-item lines="none" class="rounded-lg border border-gray-100">
|
||||||
|
<ion-checkbox class="text-sm text-gray-700"
|
||||||
|
[checked]="groupForm.value.userGroups?.includes(friend.friendId)"
|
||||||
|
(ionChange)="selectFriends($event, friend.friendId)">
|
||||||
|
{{ friend.username }}
|
||||||
|
</ion-checkbox>
|
||||||
|
</ion-item>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ion-button expand="block"
|
||||||
|
class="mt-6 rounded-xl font-medium"
|
||||||
|
style="--background: #1f2937;"
|
||||||
|
(click)="createGroup()">
|
||||||
|
Créer un groupe
|
||||||
|
</ion-button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import {Component, inject, input, OnInit, output, signal} from '@angular/core';
|
||||||
|
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||||
|
import {IonicModule, LoadingController, ToastController} from "@ionic/angular";
|
||||||
|
import {
|
||||||
|
CreateGroupDto,
|
||||||
|
CreateUserGroupDto,
|
||||||
|
FriendsService,
|
||||||
|
GetFriendDto,
|
||||||
|
GetGroupDto,
|
||||||
|
GroupsService
|
||||||
|
} from "../../services/api";
|
||||||
|
import {firstValueFrom} from "rxjs";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-group-form',
|
||||||
|
templateUrl: './group-form.component.html',
|
||||||
|
styleUrls: ['./group-form.component.scss'],
|
||||||
|
imports: [
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
IonicModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class GroupFormComponent implements OnInit {
|
||||||
|
private friendsServices = inject(FriendsService);
|
||||||
|
private groupsServices = inject(GroupsService);
|
||||||
|
private loadCtrl = inject(LoadingController);
|
||||||
|
private toastCtrl = inject(ToastController);
|
||||||
|
|
||||||
|
friends = signal<GetFriendDto[]>([]);
|
||||||
|
newGroup = output<CreateGroupDto>();
|
||||||
|
|
||||||
|
groupForm: FormGroup = new FormGroup({
|
||||||
|
label: new FormControl<string>(null, [Validators.required]),
|
||||||
|
userGroups: new FormControl<CreateUserGroupDto[]>(null, [Validators.required]),
|
||||||
|
});
|
||||||
|
|
||||||
|
async ngOnInit() {
|
||||||
|
const loading = await this.loadCtrl.create({
|
||||||
|
message: 'Chargement...',
|
||||||
|
spinner: 'lines-sharp-small'
|
||||||
|
});
|
||||||
|
await loading.present();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const friends = await firstValueFrom(this.friendsServices.getAllFriendsEndpoint());
|
||||||
|
this.friends.set(friends);
|
||||||
|
} catch {
|
||||||
|
const toast = await this.toastCtrl.create({
|
||||||
|
message: 'Impossible d\'afficher les amis du joueur',
|
||||||
|
duration: 2000,
|
||||||
|
color: 'danger'
|
||||||
|
});
|
||||||
|
await toast.present();
|
||||||
|
}
|
||||||
|
await loading.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectFriends(event: any, friendId: number) {
|
||||||
|
const current = this.groupForm.value.userGroups || [];
|
||||||
|
|
||||||
|
if (event.detail.checked) {
|
||||||
|
this.groupForm.patchValue({
|
||||||
|
userGroups: [...current, friendId]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.groupForm.patchValue({
|
||||||
|
userGroups: current.filter((x: number) => x != friendId)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async createGroup() {
|
||||||
|
if (this.groupForm.invalid) {
|
||||||
|
this.groupForm.reset();
|
||||||
|
|
||||||
|
const toast = await this.toastCtrl.create({
|
||||||
|
message: 'Tous les champs doivent être saisis',
|
||||||
|
duration: 2000,
|
||||||
|
color: 'danger'
|
||||||
|
});
|
||||||
|
await toast.present();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const createGroupDto: CreateGroupDto = {
|
||||||
|
label: this.groupForm.value.label,
|
||||||
|
userGroups: this.groupForm.value.userGroups.map((x: number) => ({
|
||||||
|
userId: x
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await firstValueFrom(this.groupsServices.createGroupEndpoint(createGroupDto));
|
||||||
|
this.newGroup.emit(createGroupDto);
|
||||||
|
const toast = await this.toastCtrl.create({
|
||||||
|
message: 'Le groupe a été crée',
|
||||||
|
duration: 2000,
|
||||||
|
color: 'success'
|
||||||
|
});
|
||||||
|
await toast.present();
|
||||||
|
} catch (e) {
|
||||||
|
const toast = await this.toastCtrl.create({
|
||||||
|
message: 'Impossible de créer le groupe',
|
||||||
|
duration: 2000,
|
||||||
|
color: 'danger'
|
||||||
|
});
|
||||||
|
await toast.present();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
import {Component, input} from '@angular/core';
|
||||||
import {IonicModule, LoadingController, ToastController} from "@ionic/angular";
|
import {IonicModule} from "@ionic/angular";
|
||||||
import {GetGroupDto, GroupsService} from "../../services/api";
|
import {GetGroupDto} from "../../services/api";
|
||||||
import {firstValueFrom} from "rxjs";
|
|
||||||
import {addIcons} from "ionicons";
|
import {addIcons} from "ionicons";
|
||||||
import {chatbubblesOutline, chevronForwardOutline} from "ionicons/icons";
|
import {chatbubblesOutline, chevronForwardOutline} from "ionicons/icons";
|
||||||
|
|
||||||
@@ -18,36 +17,6 @@ addIcons({
|
|||||||
IonicModule
|
IonicModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class GroupsComponent implements OnInit {
|
export class GroupsComponent {
|
||||||
private groupsService = inject(GroupsService);
|
groups = input.required<GetGroupDto[]>();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,14 @@
|
|||||||
<ion-buttons slot="secondary">
|
<ion-buttons slot="secondary">
|
||||||
<ion-button fill="solid" style="--background: #F0EFE9;"
|
<ion-button fill="solid" style="--background: #F0EFE9;"
|
||||||
class="border border-gray-300 rounded-lg overflow-hidden"
|
class="border border-gray-300 rounded-lg overflow-hidden"
|
||||||
(click)="setOpen(true)">
|
(click)="setOpen(true, true)">
|
||||||
<ion-icon slot="icon-only" class="text-xl text-gray-500" name="profile"></ion-icon>
|
<ion-icon slot="icon-only" class="text-xl text-gray-500" name="profile"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-buttons slot="primary">
|
<ion-buttons slot="primary">
|
||||||
<ion-button fill="solid" style="--background: #F0EFE9;"
|
<ion-button fill="solid" style="--background: #F0EFE9;"
|
||||||
class="border border-gray-300 rounded-lg overflow-hidden">
|
class="border border-gray-300 rounded-lg overflow-hidden"
|
||||||
|
(click)="setOpen(true, false)">
|
||||||
<ion-icon slot="icon-only" class="text-2xl text-gray-500" name="add"></ion-icon>
|
<ion-icon slot="icon-only" class="text-2xl text-gray-500" name="add"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<app-title-part textInfo="Messages"></app-title-part>
|
<app-title-part textInfo="Messages"></app-title-part>
|
||||||
<app-groups></app-groups>
|
<app-groups [groups]="groups()"></app-groups>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
@@ -34,26 +35,30 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-button fill="clear" (click)="view == 'menu' ? setOpen(false) : backToMenu()">
|
<ion-button fill="clear" (click)="view == 'menu' ? setOpen(false, true) : backToMenu()">
|
||||||
<ion-icon name="chevron-back"></ion-icon>
|
<ion-icon name="chevron-back"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>
|
<ion-title>
|
||||||
@switch (view) {
|
@if (isGroupModal){
|
||||||
@case ('profile') {
|
Créer un groupe
|
||||||
Modifier mon profil
|
} @else {
|
||||||
}
|
@switch (view) {
|
||||||
@case ('password') {
|
@case ('profile') {
|
||||||
Mot de passe
|
Modifier mon profil
|
||||||
}
|
}
|
||||||
@case ('designation') {
|
@case ('password') {
|
||||||
Changer mon titre
|
Mot de passe
|
||||||
}
|
}
|
||||||
@case ('gallery') {
|
@case ('designation') {
|
||||||
Ma Galerie
|
Changer mon titre
|
||||||
}
|
}
|
||||||
@default {
|
@case ('gallery') {
|
||||||
Profil
|
Ma Galerie
|
||||||
|
}
|
||||||
|
@default {
|
||||||
|
Profil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</ion-title>
|
</ion-title>
|
||||||
@@ -61,52 +66,56 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content class="ion-padding" style="--background: #f7f6f2;">
|
<ion-content class="ion-padding" style="--background: #f7f6f2;">
|
||||||
@switch (view) {
|
@if (isGroupModal) {
|
||||||
@case ('menu') {
|
<app-group-form (newGroup)="updateGroup($event)"></app-group-form>
|
||||||
<app-generic-user-info [userInfo]="user()"></app-generic-user-info>
|
} @else {
|
||||||
<div class="mt-4">
|
@switch (view) {
|
||||||
<app-title-part textInfo="Mes participations"></app-title-part>
|
@case ('menu') {
|
||||||
<app-challenges-accomplished
|
<app-generic-user-info [userInfo]="user()"></app-generic-user-info>
|
||||||
[userChallenges]="userChallenge()"></app-challenges-accomplished>
|
<div class="mt-4">
|
||||||
</div>
|
<app-title-part textInfo="Mes participations"></app-title-part>
|
||||||
|
<app-challenges-accomplished
|
||||||
|
[userChallenges]="userChallenge()"></app-challenges-accomplished>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<app-title-part textInfo="Succès"></app-title-part>
|
<app-title-part textInfo="Succès"></app-title-part>
|
||||||
<app-user-achievements [achievements]="userAchievement()"></app-user-achievements>
|
<app-user-achievements [achievements]="userAchievement()"></app-user-achievements>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<app-title-part textInfo="Paramètres de compte"></app-title-part>
|
<app-title-part textInfo="Paramètres de compte"></app-title-part>
|
||||||
<app-settings-options (navigate)="setView($event)"></app-settings-options>
|
<app-settings-options (navigate)="setView($event)"></app-settings-options>
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@case ('profile') {
|
|
||||||
<app-modal>
|
|
||||||
<div class="p-4">
|
|
||||||
<app-profil-form [user]="user()" (userEdited)="user.set($event)"></app-profil-form>
|
|
||||||
</div>
|
</div>
|
||||||
</app-modal>
|
}
|
||||||
}
|
@case ('profile') {
|
||||||
@case ('password') {
|
<app-modal>
|
||||||
<app-modal>
|
<div class="p-4">
|
||||||
<div class="p-4">
|
<app-profil-form [user]="user()" (userEdited)="user.set($event)"></app-profil-form>
|
||||||
<app-password-form></app-password-form>
|
</div>
|
||||||
</div>
|
</app-modal>
|
||||||
</app-modal>
|
}
|
||||||
}
|
@case ('password') {
|
||||||
@case ('designation') {
|
<app-modal>
|
||||||
<app-modal>
|
<div class="p-4">
|
||||||
<div class="p-4">
|
<app-password-form></app-password-form>
|
||||||
<app-designation-form [user]="user()"
|
</div>
|
||||||
(userDesignation)="user.set($event)">
|
</app-modal>
|
||||||
</app-designation-form>
|
}
|
||||||
</div>
|
@case ('designation') {
|
||||||
</app-modal>
|
<app-modal>
|
||||||
}
|
<div class="p-4">
|
||||||
@case ('gallery') {
|
<app-designation-form [user]="user()"
|
||||||
<app-modal>
|
(userDesignation)="user.set($event)">
|
||||||
<app-gallery></app-gallery>
|
</app-designation-form>
|
||||||
</app-modal>
|
</div>
|
||||||
|
</app-modal>
|
||||||
|
}
|
||||||
|
@case ('gallery') {
|
||||||
|
<app-modal>
|
||||||
|
<app-gallery></app-gallery>
|
||||||
|
</app-modal>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||||
import {IonicModule, LoadingController, ToastController} from "@ionic/angular";
|
import {IonicModule, LoadingController, ModalController, ToastController} from "@ionic/angular";
|
||||||
import {addIcons} from "ionicons";
|
import {addIcons} from "ionicons";
|
||||||
import {personOutline, addOutline, settingsOutline} from "ionicons/icons";
|
import {personOutline, addOutline, settingsOutline} from "ionicons/icons";
|
||||||
import {TitlePartComponent} from "../../components/title-part/title-part.component";
|
import {TitlePartComponent} from "../../components/title-part/title-part.component";
|
||||||
import {ChallengeCardComponent} from "../../components/challenge-card/challenge-card.component";
|
import {ChallengeCardComponent} from "../../components/challenge-card/challenge-card.component";
|
||||||
import {
|
import {
|
||||||
AchievementsService,
|
AchievementsService, CreateGroupDto,
|
||||||
GetAchievementDto,
|
GetAchievementDto, GetGroupDto,
|
||||||
GetRandomChallengeDto,
|
GetRandomChallengeDto,
|
||||||
GetUserChallengeDto,
|
GetUserChallengeDto,
|
||||||
GetUserDetailsDto,
|
GetUserDetailsDto, GroupsService,
|
||||||
RandomchallengesService,
|
RandomchallengesService,
|
||||||
UsersService
|
UsersService
|
||||||
} from "../../services/api";
|
} from "../../services/api";
|
||||||
@@ -26,6 +26,7 @@ import {PasswordFormComponent} from "../../components/password-form/password-for
|
|||||||
import {DesignationFormComponent} from "../../components/designation-form/designation-form.component";
|
import {DesignationFormComponent} from "../../components/designation-form/designation-form.component";
|
||||||
import {GalleryComponent} from "../../components/gallery/gallery.component";
|
import {GalleryComponent} from "../../components/gallery/gallery.component";
|
||||||
import {GroupsComponent} from "../../components/groups/groups.component";
|
import {GroupsComponent} from "../../components/groups/groups.component";
|
||||||
|
import {GroupFormComponent} from "../../components/group-form/group-form.component";
|
||||||
|
|
||||||
addIcons({
|
addIcons({
|
||||||
'profile': personOutline,
|
'profile': personOutline,
|
||||||
@@ -54,6 +55,7 @@ type View = 'menu' | 'profile' | 'password' | 'designation' | 'gallery';
|
|||||||
DesignationFormComponent,
|
DesignationFormComponent,
|
||||||
GalleryComponent,
|
GalleryComponent,
|
||||||
GroupsComponent,
|
GroupsComponent,
|
||||||
|
GroupFormComponent,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class HomeComponent implements OnInit {
|
export class HomeComponent implements OnInit {
|
||||||
@@ -62,13 +64,16 @@ export class HomeComponent implements OnInit {
|
|||||||
private usersService = inject(UsersService);
|
private usersService = inject(UsersService);
|
||||||
private loadCtrl = inject(LoadingController);
|
private loadCtrl = inject(LoadingController);
|
||||||
private achievementsService = inject(AchievementsService);
|
private achievementsService = inject(AchievementsService);
|
||||||
|
private groupsService = inject(GroupsService);
|
||||||
|
|
||||||
randomChallenge = signal<GetRandomChallengeDto>({});
|
randomChallenge = signal<GetRandomChallengeDto>({});
|
||||||
user = signal<GetUserDetailsDto>({})
|
user = signal<GetUserDetailsDto>({})
|
||||||
userChallenge = signal<GetUserChallengeDto[]>([]);
|
userChallenge = signal<GetUserChallengeDto[]>([]);
|
||||||
userAchievement = signal<GetAchievementDto[]>([])
|
userAchievement = signal<GetAchievementDto[]>([])
|
||||||
|
groups = signal<GetGroupDto[]>([])
|
||||||
|
|
||||||
isModalOpen = false;
|
isModalOpen = false;
|
||||||
|
isGroupModal = false;
|
||||||
view: View = 'menu';
|
view: View = 'menu';
|
||||||
|
|
||||||
setView(choice: View) {
|
setView(choice: View) {
|
||||||
@@ -82,7 +87,9 @@ export class HomeComponent implements OnInit {
|
|||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
try {
|
try {
|
||||||
const randomChallenge = await firstValueFrom(this.randomChallengeService.generateRandomChallengeEndpoint());
|
const randomChallenge = await firstValueFrom(this.randomChallengeService.generateRandomChallengeEndpoint());
|
||||||
|
const groups = await firstValueFrom(this.groupsService.getAllGroupsEndpoint());
|
||||||
this.randomChallenge.set(randomChallenge);
|
this.randomChallenge.set(randomChallenge);
|
||||||
|
this.groups.set(groups);
|
||||||
} catch {
|
} catch {
|
||||||
const toast = await this.toastCtrl.create({
|
const toast = await this.toastCtrl.create({
|
||||||
message: 'Impossible de générer un défi aléatoire',
|
message: 'Impossible de générer un défi aléatoire',
|
||||||
@@ -93,31 +100,42 @@ export class HomeComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setOpen(isOpen: boolean) {
|
async setOpen(isOpen: boolean, profil: boolean) {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
const loading = await this.loadCtrl.create({
|
const loading = await this.loadCtrl.create({
|
||||||
message: 'Chargement...',
|
message: 'Chargement...',
|
||||||
spinner: 'lines-sharp-small'
|
spinner: 'lines-sharp-small'
|
||||||
});
|
});
|
||||||
await loading.present();
|
await loading.present();
|
||||||
try {
|
|
||||||
const userInfo = await firstValueFrom(this.usersService.getUserDetailsEndpoint());
|
|
||||||
const userChallenge = await firstValueFrom(this.usersService.getAllUserChallengesEndpoint());
|
|
||||||
const userAchievement = await firstValueFrom((this.achievementsService.getUserAchievementsEndpoint()));
|
|
||||||
|
|
||||||
this.user.set(userInfo);
|
if (profil) {
|
||||||
this.userChallenge.set(userChallenge);
|
this.isGroupModal = !profil;
|
||||||
this.userAchievement.set(userAchievement);
|
try {
|
||||||
} catch {
|
const userInfo = await firstValueFrom(this.usersService.getUserDetailsEndpoint());
|
||||||
const toast = await this.toastCtrl.create({
|
const userChallenge = await firstValueFrom(this.usersService.getAllUserChallengesEndpoint());
|
||||||
message: 'Impossible de charger les données du joueur',
|
const userAchievement = await firstValueFrom((this.achievementsService.getUserAchievementsEndpoint()));
|
||||||
duration: 2000,
|
|
||||||
color: 'danger'
|
this.user.set(userInfo);
|
||||||
});
|
this.userChallenge.set(userChallenge);
|
||||||
await toast.present();
|
this.userAchievement.set(userAchievement);
|
||||||
|
} catch {
|
||||||
|
const toast = await this.toastCtrl.create({
|
||||||
|
message: 'Impossible de charger les données du joueur',
|
||||||
|
duration: 2000,
|
||||||
|
color: 'danger'
|
||||||
|
});
|
||||||
|
await toast.present();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.isGroupModal = !profil;
|
||||||
}
|
}
|
||||||
await loading.dismiss();
|
await loading.dismiss();
|
||||||
}
|
}
|
||||||
this.isModalOpen = isOpen;
|
this.isModalOpen = isOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateGroup(newGroup: CreateGroupDto) {
|
||||||
|
this.groups.update(x => [...x, newGroup])
|
||||||
|
await this.setOpen(false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user