From f9308f0e1337bc0b4f49a44905f773ba4be81273 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Tue, 21 Mar 2023 13:58:52 +0200 Subject: [PATCH] RED-6162 - tenant context --- .../upload-download/services/file-download.service.ts | 8 ++++++-- apps/red-ui/src/app/utils/tenant-context.ts | 8 ++++++++ apps/red-ui/src/app/utils/tenant-id-interceptor.ts | 7 +++++-- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 apps/red-ui/src/app/utils/tenant-context.ts diff --git a/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts b/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts index dc759108a..e11dc0a4e 100644 --- a/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts +++ b/apps/red-ui/src/app/modules/upload-download/services/file-download.service.ts @@ -1,15 +1,17 @@ -import { Injectable } from '@angular/core'; +import { inject, Injectable } from '@angular/core'; import { DownloadStatus, IDownloadStatus, IDownloadStatusResponse, IPrepareDownloadRequest, IRemoveDownloadRequest } from '@red/domain'; import { firstValueFrom, Observable } from 'rxjs'; import { ConfigService } from '@services/config.service'; import { map, tap } from 'rxjs/operators'; import { EntitiesService, mapEach, RequiredParam, Validate } from '@iqser/common-ui'; import { NGXLogger } from 'ngx-logger'; +import { TenantContext } from '@utils/tenant-context'; @Injectable() export class FileDownloadService extends EntitiesService { protected readonly _defaultModelPath = 'async/download'; protected readonly _entityClass = DownloadStatus; + protected readonly _tenantContext = inject(TenantContext); constructor(private readonly _configService: ConfigService, private readonly _logger: NGXLogger) { super(); @@ -34,7 +36,9 @@ export class FileDownloadService extends EntitiesService, next: HttpHandler): Observable> { const updatedRequest = req.clone({ - setHeaders: { 'X-TENANT-ID': 'redaction' }, + setHeaders: { 'X-TENANT-ID': this._tenantContext.getTenant() }, }); return next.handle(updatedRequest); }