From 16ddf6e1dd79d354d195406dd57877885dbe5b84 Mon Sep 17 00:00:00 2001 From: dominikiwanekhyland <141320833+dominikiwanekhyland@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:37:14 +0200 Subject: [PATCH] Refactor effects to use inject() (#4080) --- .../src/lib/store/effects/library.effects.ts | 17 +++++++---------- .../store/src/effects/router.effects.ts | 9 +++++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/projects/aca-content/src/lib/store/effects/library.effects.ts b/projects/aca-content/src/lib/store/effects/library.effects.ts index 73e02a80c3..d17ba5ee9d 100644 --- a/projects/aca-content/src/lib/store/effects/library.effects.ts +++ b/projects/aca-content/src/lib/store/effects/library.effects.ts @@ -26,15 +26,15 @@ import { AppStore, CreateLibraryAction, DeleteLibraryAction, + getAppSelection, LeaveLibraryAction, LibraryActionTypes, NavigateLibraryAction, NavigateRouteAction, - UpdateLibraryAction, - getAppSelection + UpdateLibraryAction } from '@alfresco/aca-shared/store'; import { inject, Injectable } from '@angular/core'; -import { Actions, ofType, createEffect } from '@ngrx/effects'; +import { Actions, createEffect, ofType } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { map, mergeMap, take } from 'rxjs/operators'; import { ContentApiService } from '@alfresco/aca-shared'; @@ -44,13 +44,10 @@ import { NotificationService } from '@alfresco/adf-core'; @Injectable() export class LibraryEffects { private notificationService = inject(NotificationService); - - constructor( - private store: Store, - private actions$: Actions, - private content: ContentManagementService, - private contentApi: ContentApiService - ) {} + private store = inject(Store); + private actions$ = inject(Actions); + private content = inject(ContentManagementService); + private contentApi = inject(ContentApiService); deleteLibrary$ = createEffect( () => diff --git a/projects/aca-shared/store/src/effects/router.effects.ts b/projects/aca-shared/store/src/effects/router.effects.ts index 29a01e00d7..d8ba3092c4 100644 --- a/projects/aca-shared/store/src/effects/router.effects.ts +++ b/projects/aca-shared/store/src/effects/router.effects.ts @@ -24,19 +24,20 @@ import { inject, Injectable } from '@angular/core'; import { Router } from '@angular/router'; -import { Actions, ofType, createEffect } from '@ngrx/effects'; +import { Actions, createEffect, ofType } from '@ngrx/effects'; import { Node, PathInfo } from '@alfresco/js-api'; import { map } from 'rxjs/operators'; import { Location } from '@angular/common'; -import { NavigateUrlAction, NavigateRouteAction, NavigateToFolder, NavigateToParentFolder, NavigateToPreviousPage } from '../actions/router.actions'; +import { NavigateRouteAction, NavigateToFolder, NavigateToParentFolder, NavigateToPreviousPage, NavigateUrlAction } from '../actions/router.actions'; import { RouterActionTypes } from '../actions/router-action-types'; import { NotificationService } from '@alfresco/adf-core'; @Injectable() export class RouterEffects { private notificationService = inject(NotificationService); - - constructor(private actions$: Actions, private router: Router, private location: Location) {} + private actions$ = inject(Actions); + private router = inject(Router); + private location = inject(Location); navigateUrl$ = createEffect( () =>