You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

47 line
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 {ApiConverter} from "@app/_helpers/api.converter";
  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 apiConverter: ApiConverter
  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.apiConverter.extractId(user.id)
  33. ).subscribe(
  34. data => {
  35. this.user = data;
  36. }
  37. );
  38. }
  39. }
  40. }