Merge Angular 16 Irish Monitor to develop #33

Merged
k.triantafyllou merged 151 commits from angular-16-irish-monitor into develop 2024-02-13 09:32:41 +01:00
1 changed files with 8 additions and 8 deletions
Showing only changes of commit c6dd26dcee - Show all commits

View File

@ -21,9 +21,8 @@ export class UserProfile{
})
export class UserProfileService {
private subscription;
private readonly getUserProfileSubject: AdvancedAsyncSubject<UserProfile> = new AdvancedAsyncSubject<UserProfile>();
private readonly userProfileSubject: AdvancedAsyncSubject<UserProfile> = new AdvancedAsyncSubject<UserProfile>();
constructor(private http: HttpClient) {
this.updateUserProfile();
}
clearSubscriptions() {
@ -34,26 +33,27 @@ export class UserProfileService {
}
public get user(): UserProfile {
return this.getUserProfileSubject.getValue();
return this.userProfileSubject.getValue();
}
public getUserProfile(): Observable<UserProfile> {
return this.getUserProfileSubject.asObservable();
return this.userProfileSubject.asObservable();
}
public setUserProfile(userProfile:UserProfile) {
this.getUserProfileSubject.next(userProfile);
this.userProfileSubject.next(userProfile?userProfile:new UserProfile(false));
}
public updateUserProfile(resolve: Function = null) {
public initUserProfile(resolve: Function = null) {
this.subscription = this.http.get<UserProfile>(properties.monitorServiceAPIURL + 'user', CustomOptions.registryOptions()).pipe(map(userProfile => {
return userProfile;
})).subscribe(user => {
this.getUserProfileSubject.next(user);
this.userProfileSubject.next(user);
if (resolve) {
resolve();
}
}, error => {
this.getUserProfileSubject.next(null);
this.userProfileSubject.next(new UserProfile(false));
if (resolve) {
resolve();
}