IPad fIx test 2

This commit is contained in:
Lorenz Hilpert
2023-03-08 18:58:02 +01:00
parent ccbec5bcff
commit fba324c6cb
5 changed files with 19 additions and 15 deletions

View File

@@ -94,9 +94,9 @@ export class AuthService {
async logout() {
await this._oAuthService.revokeTokenAndLogout();
asapScheduler.schedule(() => {
window.location.reload();
}, 250);
// asapScheduler.schedule(() => {
// window.location.reload();
// }, 250);
}
hasRole(role: string | string[]) {

View File

@@ -143,11 +143,9 @@ export class AppComponent implements OnInit {
title: 'Sie sind nicht mehr angemeldet',
data: { message: 'Sie werden neu angemeldet' },
})
.afterClosed$.pipe(
tap(() => {
this._authService.logout();
})
);
.afterClosed$.subscribe(() => {
this._authService.login();
});
}
}
}

View File

@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpEvent, HttpHandler, HttpRequest, HttpErrorResponse } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { NEVER, Observable, throwError } from 'rxjs';
import { UiMessageModalComponent, UiModalService } from '@ui/modal';
import { catchError, mergeMap, tap } from 'rxjs/operators';
import { AuthService } from '@core/auth';
@@ -25,6 +25,7 @@ export class HttpErrorInterceptor implements HttpInterceptor {
})
.afterClosed$.pipe(mergeMap(() => throwError(error)));
} else if (error.status === 401) {
console.log('401', error);
return this._modal
.open({
content: UiMessageModalComponent,
@@ -33,9 +34,9 @@ export class HttpErrorInterceptor implements HttpInterceptor {
})
.afterClosed$.pipe(
tap(() => {
this._auth.logout();
this._auth.login();
}),
mergeMap(() => throwError(error))
mergeMap(() => NEVER)
);
}

View File

@@ -30,9 +30,16 @@ export class NativeContainerService {
this.messages$.subscribe((message) => {
if (message.status === 'INIT') {
this._isNative = true;
this._postMessage({ status: 'INIT', data: 'Is a WebView' });
}
});
// Functions to be called from native app
if (this.window['scanResults'] === undefined) {
this.window['scanResults'] = (result) => this._postMessage(result);
}
if (this.window['isRunningNative'] === undefined) {
this.window['isRunningNative'] = (_) => this._postMessage({ status: 'INIT', data: 'Is a WebView' });
}
}
openScanner(scanRequestType: ScanRequestType) {

View File

@@ -11,8 +11,6 @@ import { UiModalRef } from './defs';
`,
styleUrls: ['./message-modal.component.scss'],
})
export class UiMessageModalComponent implements OnInit {
export class UiMessageModalComponent {
constructor(public modalRef: UiModalRef) {}
ngOnInit() {}
}