|
- import {AfterViewInit, Component, Input, OnInit} from '@angular/core';
- import {Subscription} from "rxjs";
- import {UserJsonld, UserService} from "@app/core/api/v1";
- import {AccountService} from "@app/_services";
- import {AppHelperService} from "@app/_helpers/app-helper.service";
-
- @Component({
- selector: 'app-users',
- templateUrl: './users.component.html',
- styleUrl: './users.component.scss'
- })
- export class UsersComponent implements OnInit, AfterViewInit {
-
- @Input() public user!: UserJsonld;
-
- constructor(
- private accountService: AccountService,
- private userService: UserService,
- protected appHelperService: AppHelperService
- ) {
- }
-
- ngOnInit() {
-
- }
-
- ngAfterViewInit(): void {
- this.getData();
- }
-
- getData() {
- const user = this.accountService.userValue;
- if (user?.id !== null && user?.id !== undefined) {
- this.userService.usersIdGet(
- this.appHelperService.extractId(user.id)
- ).subscribe(
- data => {
- this.user = data;
- }
- );
- }
- }
-
- }
|