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
+31 -3
View File
@@ -1,11 +1,12 @@
import {Component} from '@angular/core';
import {Component, inject, OnInit} from '@angular/core';
import {TitlePartComponent} from "../../components/title-part/title-part.component";
import {IonicModule} from "@ionic/angular";
import {IonicModule, LoadingController} from "@ionic/angular";
import {FriendRequestComponent} from "../../components/friend-request/friend-request.component";
import {FriendsListComponent} from "../../components/friends/friends-list.component";
import {addIcons} from "ionicons";
import {addCircleOutline} from 'ionicons/icons';
import {SearchFriendComponent} from "../../components/search-friend/search-friend.component";
import {FriendsStateService} from "../../services/friends-state";
addIcons({
"send": addCircleOutline
@@ -23,6 +24,33 @@ addIcons({
SearchFriendComponent
]
})
export class SocialComponent {
export class SocialComponent implements OnInit {
private friendsState = inject(FriendsStateService);
private loadCtrl = inject(LoadingController);
async ngOnInit() {
const loading = await this.loadCtrl.create({
message: 'Chargement...',
spinner: 'lines-sharp-small'
});
await loading.present();
await this.friendsState.fetchFriendsRequest();
await this.friendsState.fetchFriends();
await loading.dismiss();
}
async ionViewWillEnter() {
const loading = await this.loadCtrl.create({
message: 'Chargement...',
spinner: 'lines-sharp-small'
});
await loading.present();
await this.friendsState.fetchFriendsRequest();
await this.friendsState.fetchFriends();
await loading.dismiss();
}
}