diff --git a/projects/storefrontlib/cms-structure/services/cms-guards.service.ts b/projects/storefrontlib/cms-structure/services/cms-guards.service.ts index 5194b393448..c9787105971 100644 --- a/projects/storefrontlib/cms-structure/services/cms-guards.service.ts +++ b/projects/storefrontlib/cms-structure/services/cms-guards.service.ts @@ -4,16 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Injectable, inject } from '@angular/core'; +import { inject, Injectable } from '@angular/core'; import { CanActivateFn, RouterStateSnapshot, UrlTree } from '@angular/router'; import { CmsActivatedRouteSnapshot, FeatureConfigService, - UnifiedInjector, getLastValueSync, + UnifiedInjector, wrapIntoObservable, } from '@spartacus/core'; -import { Observable, concat, of } from 'rxjs'; +import { concat, Observable, of } from 'rxjs'; import { endWith, first, skipWhile } from 'rxjs/operators'; import { CmsComponentsService } from './cms-components.service'; import { CanActivate, GuardsComposer } from './guards-composer'; diff --git a/projects/storefrontlib/cms-structure/services/cms-routes-impl.service.ts b/projects/storefrontlib/cms-structure/services/cms-routes-impl.service.ts index 7dff130f435..a7d04695ac6 100644 --- a/projects/storefrontlib/cms-structure/services/cms-routes-impl.service.ts +++ b/projects/storefrontlib/cms-structure/services/cms-routes-impl.service.ts @@ -135,9 +135,13 @@ export class CmsRoutesImplService { } if (route?.canActivate?.length) { - route.canActivate = route.canActivate.map((guard) => + const canActivate = route.canActivate.map((guard) => this.wrapCmsGuard(guard) ); + return { + ...route, + canActivate, + }; } return route;