RED-3800 added x-tenant-id header for backend compatiblity on multi-tenancy
This commit is contained in:
parent
67b2297374
commit
b69c4de4bb
@ -55,6 +55,7 @@ import { ILoggerConfig } from '@red/domain';
|
||||
import { SystemPreferencesService } from '@services/system-preferences.service';
|
||||
import { PdfViewerModule } from './modules/pdf-viewer/pdf-viewer.module';
|
||||
import { LicenseService } from '@services/license.service';
|
||||
import { TenantIdInterceptor } from '@utils/tenant-id-interceptor';
|
||||
|
||||
export function httpLoaderFactory(httpClient: HttpClient, configService: ConfigService): PruningTranslationLoader {
|
||||
return new PruningTranslationLoader(httpClient, '/assets/i18n/', `.json?version=${configService.values.FRONTEND_APP_VERSION}`);
|
||||
@ -168,6 +169,11 @@ const components = [AppComponent, AuthErrorComponent, NotificationsComponent, Sp
|
||||
multi: true,
|
||||
useClass: ApiPathInterceptor,
|
||||
},
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
multi: true,
|
||||
useClass: TenantIdInterceptor,
|
||||
},
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
multi: true,
|
||||
|
||||
13
apps/red-ui/src/app/utils/tenant-id-interceptor.ts
Normal file
13
apps/red-ui/src/app/utils/tenant-id-interceptor.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class TenantIdInterceptor implements HttpInterceptor {
|
||||
intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||
const updatedRequest = req.clone({
|
||||
setHeaders: { 'X-TENANT-ID': 'redaction' },
|
||||
});
|
||||
return next.handle(updatedRequest);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user