userService.ts
private APIUrl: string = environment.APIUrl;
constructor(private inService: API,
private httpClient: HttpClient) { }
private _userDataDashboard$ = new ReplaySubject<UserDetailsDashboard>(1);
getUserDetailsSubject(): Observable<UserDetailsDashboard> {
return this._userDataDashboard$.asObservable();
}
refreshUserData(): Observable<void> {
const headers = new HttpHeaders()
.set('Authorization', 'Bearer ' + localStorage.getItem(AppConstants.TOKEN));
return this.httpClient.get<any>(this.APIUrl, {headers: headers}).pipe(
tap((response: any) => {
// notify all subscribers of new data
this._userDataDashboard$.next(response.data );
})
);
}
I have invoked this method within a section where the user enters details: Profile.ts
submitBasicDetails(basicDetails: {}) {
this.isLoading = true;
this.inService.submitBasicDetails(basicDetails).subscribe(
(response: any) => {
this.userService.refreshUserData();
)}
When I try to display the fullName parameter in Dashboard.html, it doesn't show up
<h1>Hi {{data.firstName}}</h1>
I'm seeking assistance in resolving this issue.