From bef14dda67f8dd205ab9661f75b0225a2d85641b Mon Sep 17 00:00:00 2001 From: "swapnil.verma" Date: Wed, 26 Jun 2024 14:56:00 +0530 Subject: [PATCH] Updated shell-app.service.ts > SHELL_AUTH_TOKEN to use functional route guards instead of class based one --- lib/core/shell/README.md | 3 ++- .../shell/src/lib/services/shell-app.service.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/core/shell/README.md b/lib/core/shell/README.md index 1ec3c83f4b6..332ae311dff 100644 --- a/lib/core/shell/README.md +++ b/lib/core/shell/README.md @@ -10,7 +10,8 @@ I order to attach routes to appShell, `withRoutes(routes: Routes | AppShellRoute Passed routes are going to be attached to [shell main route](./src/lib/shell.routes.ts) -If you would like to provide custom app guard, you can provide your own using [SHELL_AUTH_TOKEN](./src/lib/shell.routes.ts) +If you would like to provide custom app guard, you can provide your own using [SHELL_AUTH_TOKEN](./src/lib/shell.routes.ts). Keep in mind that +the custom app guard must be a functional route guard, instead of a class based one. ## Shell Service diff --git a/lib/core/shell/src/lib/services/shell-app.service.ts b/lib/core/shell/src/lib/services/shell-app.service.ts index a02d6a5c755..264d3f5fde3 100644 --- a/lib/core/shell/src/lib/services/shell-app.service.ts +++ b/lib/core/shell/src/lib/services/shell-app.service.ts @@ -16,23 +16,23 @@ */ import { InjectionToken } from '@angular/core'; -import { CanActivate, CanActivateChild } from '@angular/router'; +import { CanActivateFn, CanActivateChildFn } from '@angular/router'; import { Observable } from 'rxjs'; export interface ShellPreferencesService { - set(preferenceKey: string, value: any): void; - get(preferenceKey: string, defaultValue: string): string; + set(preferenceKey: string, value: any): void; + get(preferenceKey: string, defaultValue: string): string; } export interface ShellAppService { - pageHeading$: Observable; - hideSidenavConditions: string[]; - minimizeSidenavConditions: string[]; - preferencesService: ShellPreferencesService; + pageHeading$: Observable; + hideSidenavConditions: string[]; + minimizeSidenavConditions: string[]; + preferencesService: ShellPreferencesService; } export const SHELL_APP_SERVICE = new InjectionToken('SHELL_APP_SERVICE'); -export const SHELL_AUTH_TOKEN = new InjectionToken('SHELL_AUTH_TOKEN'); +export const SHELL_AUTH_TOKEN = new InjectionToken('SHELL_AUTH_TOKEN'); export const SHELL_NAVBAR_MIN_WIDTH = new InjectionToken('SHELL_NAVBAR_MIN_WIDTH'); export const SHELL_NAVBAR_MAX_WIDTH = new InjectionToken('SHELL_NAVBAR_MAX_WIDTH');