import {AfterViewInit, Component, OnInit} from '@angular/core'; import {User} from "@app/_models"; import {Router} from "@angular/router"; import {AccountService} from "@app/_services"; import {Subscription} from "rxjs"; import {PartnerJsonld, UserJsonld, UserService} from "@app/core/api/v1"; import {AppHelperService} from "@app/_helpers/app-helper.service"; @Component({ selector: 'app-profile', templateUrl: './profile.component.html', styleUrl: './profile.component.scss' }) export class ProfileComponent implements OnInit { protected userSub: Subscription; protected user: UserJsonld; constructor( private router: Router, private accountService: AccountService, private userService: UserService, protected appHelperService: AppHelperService ) { this.userSub = new Subscription(); this.user = {} as UserJsonld; } ngOnInit() { this.getUserData(); } getUserData() { const user = this.accountService.userValue; if (user?.id !== null && user?.id !== undefined) { this.userSub = this.userService.usersIdGet( this.appHelperService.extractId(user.id) ).subscribe( data => { this.user = data; } ); } } }