Browse Source

Merge pull request #17530 from abpframework/issue-17529

Remove confirmation error during redirect to login
pull/17531/head
Masum ULU 3 years ago
committed by GitHub
parent
commit
243464fa87
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts

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

@ -1,4 +1,4 @@
import { import {
AuthService, AuthService,
HttpErrorReporterService, HttpErrorReporterService,
LocalizationParam, LocalizationParam,
@ -86,7 +86,6 @@ export class ErrorHandler {
protected httpErrorConfig: HttpErrorConfig; protected httpErrorConfig: HttpErrorConfig;
protected sessionStateService: SessionStateService; 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);
@ -146,7 +145,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.sessionStateService.setTenant(null);
this.authService.logout().subscribe(); this.authService.logout().subscribe();
return; return;
} }
@ -162,18 +161,11 @@ export class ErrorHandler {
} else { } else {
switch (err.status) { switch (err.status) {
case 401: case 401:
this.canCreateCustomError(401) if (this.canCreateCustomError(401)) {
? this.show401Page() this.show401Page();
: this.showError( }
{
key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.title, this.navigateToLogin();
defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.title,
},
{
key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.details,
defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.details,
},
).subscribe(() => this.navigateToLogin());
break; break;
case 403: case 403:
this.createErrorComponent({ this.createErrorComponent({

Loading…
Cancel
Save