Skip to content
Snippets Groups Projects
Commit d42d5bba authored by Fadil's avatar Fadil Committed by pybelecalo
Browse files

[FIX TRTL-569] Fix get application & analytics http request headers

parent 337df216
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { AuthService } from '../auth.service';
import { BASE_URL } from '../injection-tokens';
import { Analytics } from '../models/user/analytics.interface';
import { User } from '../models/user/user.interface';
......@@ -49,12 +50,13 @@ export class UserApiService {
private readonly apiUrl: string;
constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) {
constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string, private authService: AuthService) {
this.apiUrl = baseUrl + '/users';
}
public analytics(data: { applicationId?: string, lastTenantIdentifier?: number }): Observable<User> {
return this.http.post<User>(this.apiUrl + '/analytics', data);
const headers = new HttpHeaders({ 'X-Tenant-Id': this.authService.getAnyTenantIdentifier() });
return this.http.post<User>(this.apiUrl + '/analytics', data, { headers });
}
}
......@@ -34,7 +34,7 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/
import { HttpParams } from '@angular/common/http';
import { HttpHeaders, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { BehaviorSubject } from 'rxjs';
......@@ -100,7 +100,8 @@ export class ApplicationService {
*/
list(): Observable<ApplicationInfo> {
const params = new HttpParams().set('filterApp', 'true');
return this.applicationApi.getAllByParams(params).pipe(
const headers = new HttpHeaders({ 'X-Tenant-Id': this.authService.getAnyTenantIdentifier() });
return this.applicationApi.getAllByParams(params, headers).pipe(
catchError(() => of({ APPLICATION_CONFIGURATION: [], CATEGORY_CONFIGURATION: {}})),
map((applicationInfo: ApplicationInfo) => {
this._applications = applicationInfo.APPLICATION_CONFIGURATION;
......
......@@ -65,7 +65,6 @@ mat-card-subtitle {
overflow: hidden;
min-height: 200px;
max-height: 200px;
width: 100%;
max-width: 280px;
margin: 0 auto 17px auto;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment