Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

47 righe
1.3 KiB

  1. import {AfterViewInit, Component, OnInit} from '@angular/core';
  2. import {User} from "@app/_models";
  3. import {Router} from "@angular/router";
  4. import {AccountService} from "@app/_services";
  5. import {Subscription} from "rxjs";
  6. import {PartnerJsonld, UserJsonld, UserService} from "@app/core/api/v1";
  7. import {AppHelperService} from "@app/_helpers/app-helper.service";
  8. @Component({
  9. selector: 'app-profile',
  10. templateUrl: './profile.component.html',
  11. styleUrl: './profile.component.scss'
  12. })
  13. export class ProfileComponent implements OnInit {
  14. protected userSub: Subscription;
  15. protected user: UserJsonld;
  16. constructor(
  17. private router: Router,
  18. private accountService: AccountService,
  19. private userService: UserService,
  20. protected appHelperService: AppHelperService
  21. ) {
  22. this.userSub = new Subscription();
  23. this.user = {} as UserJsonld;
  24. }
  25. ngOnInit() {
  26. this.getUserData();
  27. }
  28. getUserData() {
  29. const user = this.accountService.userValue;
  30. if (user?.id !== null && user?.id !== undefined) {
  31. this.userSub = this.userService.usersIdGet(
  32. this.appHelperService.extractId(user.id)
  33. ).subscribe(
  34. data => {
  35. this.user = data;
  36. }
  37. );
  38. }
  39. }
  40. }