All files / src/app/components/custom-views custom-views.component.ts

77.77% Statements 7/9
100% Branches 2/2
71.42% Functions 5/7
71.42% Lines 5/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40                              37x       2x     2x   2x   2x                          
import { Component, OnInit } from '@angular/core';
import { DynamicComponentService } from '../../services/dynamic-component.service';
import { LoginService } from '../../services/login.service';
import { CustomView } from '../../models/customView';
import { TableModule } from 'primeng/table';
import { TagModule } from 'primeng/tag';
import { RouterModule } from '@angular/router';
 
 
@Component({
  selector: 'app-custom-views',
  imports: [TableModule, TagModule, RouterModule],
  templateUrl: './custom-views.component.html',
  styleUrl: './custom-views.component.css'
})
export class CustomViewsComponent implements OnInit {
 
  customViews: CustomView[];
 
  constructor(private dynamicComponentService: DynamicComponentService, private loginService: LoginService){}
 
  ngOnInit(): void {
    this.loginService.getProfile().subscribe({
      next: value => {
        this.dynamicComponentService.getCustomViewsFromUserId(value.id).subscribe({
          next: value => {
            this.customViews = value;
          },
          error: error => {
            console.log(error.error);
          }
        });
      },
      error: error => {
        console.log(error.error);
      }
    });
  }
}