|
- 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 {ApiConverter} from "@app/_helpers/api.converter";
-
- @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 apiConverter: ApiConverter
- ) {
- 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.apiConverter.extractId(user.id)
- ).subscribe(
- data => {
- this.user = data;
- }
- );
- }
-
- }
- }
|