Fixed refresh error with social page

This commit is contained in:
2026-04-14 13:46:17 +01:00
parent 4df957ddfb
commit f13541ccab
4 changed files with 69 additions and 76 deletions
@@ -18,7 +18,7 @@ addIcons({
IonicModule
]
})
export class FriendsListComponent implements OnInit {
export class FriendsListComponent {
private friendsService = inject(FriendsService);
private usersService = inject(UsersService);
private toastCtrl = inject(ToastController);
@@ -31,35 +31,6 @@ export class FriendsListComponent implements OnInit {
friends = this.friendsState.friends;
async ngOnInit() {
await this.fetchFriends();
}
async ionViewWillEnter() {
await this.fetchFriends();
}
async fetchFriends() {
const loading = await this.loadCtrl.create({
message: 'Chargement...',
spinner: 'lines-sharp-small'
});
await loading.present();
try {
const friends = await firstValueFrom(this.friendsService.getAllFriendsEndpoint());
this.friendsState.setFriends(friends);
} catch (e) {
const toast = await this.toastCtrl.create({
message: 'Amis introuvables',
duration: 2000,
color: 'primary'
});
await toast.present();
}
await loading.dismiss();
}
async deleteFriend(friendId: number) {
const loading = await this.loadCtrl.create({
message: 'Chargement...',