Merge pull request #17186 from abpframework/issue/17061

Dynamic layout must solve layout oninit.
pull/17191/head
Masum ULU 2 years ago committed by GitHub
commit 9bf8f0506a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
import { Component, Injector, isDevMode, Optional, SkipSelf, Type } from '@angular/core';
import { Component, Injector, isDevMode, OnInit, Optional, SkipSelf, Type } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { eLayoutType } from '../enums/common';
import { ABP } from '../models';
@ -16,7 +16,7 @@ import { TreeNode } from '../utils/tree-utils';
template: ` <ng-container *ngIf="isLayoutVisible" [ngComponentOutlet]="layout"></ng-container> `,
providers: [SubscriptionService],
})
export class DynamicLayoutComponent {
export class DynamicLayoutComponent implements OnInit {
layout?: Type<any>;
layoutKey?: eLayoutType;
@ -53,6 +53,13 @@ export class DynamicLayoutComponent {
this.listenToLanguageChange();
}
ngOnInit(): void {
if(this.layout){
return;
}
this.getLayout()
}
private checkLayoutOnNavigationEnd() {
const navigationEnd$ = this.routerEvents.getNavigationEvents('End');
this.subscription.addOne(navigationEnd$, () => this.getLayout());

@ -23,14 +23,8 @@ export class AbpOAuthGuard implements IAbpGuard {
if (hasValidAccessToken) {
return true;
}
return of(false).pipe(
tap(() => this.httpErrorReporter.reportError({ status: 401 } as HttpErrorResponse)),
delay(1500),
tap(() => {
const params = { returnUrl: state.url };
this.authService.navigateToLogin(params);
}),
);
return false;
}
}

Loading…
Cancel
Save