fixed guards

This commit is contained in:
Timo Bejan 2020-10-20 11:23:06 +03:00
parent 88af991b36
commit f39b2cb038
5 changed files with 2 additions and 7 deletions

View File

@ -14,7 +14,7 @@ export function keycloakInitializer(keycloak: KeycloakService, appConfigService:
let url = appConfigService.getConfig(AppConfigKey.OAUTH_URL);
url = url.replace(/\/$/, ""); // remove trailing slash
let realm = url.substring(url.lastIndexOf("/") + 1, url.length);
const realm = url.substring(url.lastIndexOf("/") + 1, url.length);
url = url.substr(0, url.lastIndexOf("/realms"));
return keycloak.init({
config: {

View File

@ -20,7 +20,7 @@ export class RedRoleGuard implements CanActivate {
) {
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
return new Observable(obs => {
if (!this._userService.user.hasAnyREDRoles) {
this._router.navigate(['/auth-error']);

View File

@ -112,7 +112,6 @@ export class FilePreviewScreenComponent implements OnInit {
}
public fileReady(viewer: string) {
console.log('ready' , viewer);
this._readyViewers.push(viewer);
this._changeDetectorRef.detectChanges();
}

View File

@ -49,12 +49,10 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy {
}
ngOnInit() {
console.log('init viewer');
this.wvDocumentLoadedHandler = this.wvDocumentLoadedHandler.bind(this);
}
wvDocumentLoadedHandler(): void {
console.log('loaded');
this.wvInstance.setFitMode('FitPage');
this.fileReady.emit();
}
@ -63,7 +61,6 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy {
this._fileDownloadService.loadFile(this.fileType, this.fileId, (data) => {
this._fileData = data
}, () => this._fileData).subscribe(() => {
console.log('load viewer');
this._loadViewer(this._fileData);
})
}

View File

@ -184,7 +184,6 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
this.appStateService.deleteProject(this.appStateService.activeProject.project);
this.ngOnDestroy();
this._router.navigate(['/ui/projects']);
console.log('navigate?');
}
});
}