From 39fe068bf2270de2173b4de631892b439ebe914d Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 24 Jul 2023 15:43:09 +0300 Subject: [PATCH] remove tenant when tenant-resolve-error triggered --- .../theme-shared/src/lib/handlers/error.handler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts index adbbba4ddf1..cc7f7337987 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts @@ -1,8 +1,9 @@ -import { + import { AuthService, HttpErrorReporterService, LocalizationParam, RouterEvents, + SessionStateService, } from '@abp/ng.core'; import { HttpErrorResponse } from '@angular/common/http'; import { @@ -83,7 +84,9 @@ export class ErrorHandler { protected cfRes: ComponentFactoryResolver; protected rendererFactory: RendererFactory2; protected httpErrorConfig: HttpErrorConfig; + protected sessionStateService: SessionStateService; private authService: AuthService; + constructor(protected injector: Injector) { this.httpErrorReporter = injector.get(HttpErrorReporterService); @@ -93,6 +96,7 @@ export class ErrorHandler { this.rendererFactory = injector.get(RendererFactory2); this.httpErrorConfig = injector.get('HTTP_ERROR_CONFIG'); this.authService = this.injector.get(AuthService); + this.sessionStateService = this.injector.get(SessionStateService); this.listenToRestError(); this.listenToRouterError(); @@ -142,6 +146,7 @@ export class ErrorHandler { }; if (err instanceof HttpErrorResponse && err.headers.get('Abp-Tenant-Resolve-Error')) { + this.sessionStateService.setTenant(null) this.authService.logout().subscribe(); return; }