Project

General

Profile

1
import { Injectable } from '@angular/core';
2
import { HttpClient } from '@angular/common/http';
3
import { Observable, of, } from 'rxjs';
4
import { environment } from 'src/environments/environment';
5
import { GenericRestService } from 'src/app/shared/services/generic-rest.service';
6
import { AuthService } from 'src/app/shared/services/auth.service';
7
import { DashboardSection } from 'src/app/shared/models/dashboard-section.interface';
8

    
9

    
10
@Injectable({
11
  providedIn: 'root'
12
})
13
export class DashboardService extends GenericRestService<DashboardSection> {
14

    
15
  constructor(private http: HttpClient, private authService: AuthService) {
16
    super(`${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}/dashboard`, http);
17
  }
18

    
19
  getDashboardSections(sectionType: string, sectionPage: string, sectionOffset: string, clients: string[]) {
20
    const parameters = { 
21
      page: sectionPage,
22
      offset: sectionOffset,
23
    };
24

    
25
    const data = {
26
      userId: this.authService?.userDetails?.id?.toString(), 
27
      type: sectionType,
28
      clients: clients,
29
    };
30

    
31
    return this.http.post<DashboardSection[]>(this.baseUrl, data, { params: parameters });
32
  }
33

    
34
}
(2-2/2)