From 0e99f2adf601c131092c7ec1b9a95990a5f44e2a Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Thu, 28 Mar 2024 06:36:30 +0300 Subject: [PATCH] fix: environment config condition to recall the layout render --- .../lib/components/dynamic-layout.component.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts b/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts index 9d5df4d204..db4ef66510 100644 --- a/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts +++ b/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts @@ -11,13 +11,14 @@ import { SubscriptionService } from '../services/subscription.service'; import { findRoute, getRoutePath } from '../utils/route-utils'; import { TreeNode } from '../utils/tree-utils'; import { DYNAMIC_LAYOUTS_TOKEN } from '../tokens/dynamic-layout.token'; +import { EnvironmentService } from '../services'; @Component({ selector: 'abp-dynamic-layout', template: ` `, providers: [SubscriptionService], }) -export class DynamicLayoutComponent { +export class DynamicLayoutComponent implements OnInit { layout?: Type; layoutKey?: eLayoutType; readonly layouts = inject(DYNAMIC_LAYOUTS_TOKEN); @@ -30,6 +31,18 @@ export class DynamicLayoutComponent { protected readonly replaceableComponents = inject(ReplaceableComponentsService); protected readonly subscription = inject(SubscriptionService); protected readonly routerEvents = inject(RouterEvents); + protected readonly environment = inject(EnvironmentService); + + ngOnInit(): void { + if (this.layout) { + return; + } + + const env = this.environment.getEnvironment(); + if (env?.oAuthConfig?.responseType === 'code') { + this.getLayout(); + } + } constructor(@Optional() @SkipSelf() dynamicLayoutComponent: DynamicLayoutComponent) { if (dynamicLayoutComponent) {