Fixed refresh error with social page
This commit is contained in:
@@ -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...',
|
||||
|
||||
Reference in New Issue
Block a user