Browse Source

remove tenant when tenant-resolve-error triggered

pull/17173/head
Mahmut Gundogdu 3 years ago
parent
commit
39fe068bf2
  1. 7
      npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts

7
npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts

@ -1,8 +1,9 @@
import { import {
AuthService, AuthService,
HttpErrorReporterService, HttpErrorReporterService,
LocalizationParam, LocalizationParam,
RouterEvents, RouterEvents,
SessionStateService,
} from '@abp/ng.core'; } from '@abp/ng.core';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { import {
@ -83,7 +84,9 @@ export class ErrorHandler {
protected cfRes: ComponentFactoryResolver; protected cfRes: ComponentFactoryResolver;
protected rendererFactory: RendererFactory2; protected rendererFactory: RendererFactory2;
protected httpErrorConfig: HttpErrorConfig; protected httpErrorConfig: HttpErrorConfig;
protected sessionStateService: SessionStateService;
private authService: AuthService; private authService: AuthService;
constructor(protected injector: Injector) { constructor(protected injector: Injector) {
this.httpErrorReporter = injector.get(HttpErrorReporterService); this.httpErrorReporter = injector.get(HttpErrorReporterService);
@ -93,6 +96,7 @@ export class ErrorHandler {
this.rendererFactory = injector.get(RendererFactory2); this.rendererFactory = injector.get(RendererFactory2);
this.httpErrorConfig = injector.get('HTTP_ERROR_CONFIG'); this.httpErrorConfig = injector.get('HTTP_ERROR_CONFIG');
this.authService = this.injector.get(AuthService); this.authService = this.injector.get(AuthService);
this.sessionStateService = this.injector.get(SessionStateService);
this.listenToRestError(); this.listenToRestError();
this.listenToRouterError(); this.listenToRouterError();
@ -142,6 +146,7 @@ export class ErrorHandler {
}; };
if (err instanceof HttpErrorResponse && err.headers.get('Abp-Tenant-Resolve-Error')) { if (err instanceof HttpErrorResponse && err.headers.get('Abp-Tenant-Resolve-Error')) {
this.sessionStateService.setTenant(null)
this.authService.logout().subscribe(); this.authService.logout().subscribe();
return; return;
} }

Loading…
Cancel
Save