Merged PR 1239: #3093 ISA Offline Message Fix

#3093 ISA Offline Message Fix#3093 ISA Offline Message Fix
This commit is contained in:
Nino Righi
2022-05-16 13:24:22 +00:00
committed by Andreas Schickinger
parent cd5599ff1c
commit 6b00c2c81a
2 changed files with 10 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import { HttpErrorResponse } from '@angular/common/http';
import { ErrorHandler, Injectable } from '@angular/core';
import { AuthService } from '@core/auth';
import { UiErrorModalComponent, UiModalService } from '@ui/modal';
@@ -15,6 +16,13 @@ export class IsaErrorHandler implements ErrorHandler {
return;
}
this._modal.open({ content: UiErrorModalComponent, title: 'Unbekannter Fehler', data: error });
this._modal.open({
content: UiErrorModalComponent,
title:
!navigator.onLine || (error instanceof HttpErrorResponse && error?.status === 0)
? 'Sie sind offline, keine Verbindung zum Netzwerk'
: 'Unbekannter Fehler',
data: error,
});
}
}

View File

@@ -18,10 +18,9 @@ import { UiModalRef } from '../defs';
})
export class UiErrorModalComponent implements OnInit {
get errorMessage() {
if (!navigator.onLine) {
if (!navigator.onLine || (this.error instanceof HttpErrorResponse && this.error?.status === 0)) {
return this.getOfflineMessage();
}
if (this.error instanceof HttpErrorResponse) {
if (isResponseArgs(this.error?.error)) {
return (