Skip to content

Commit

Permalink
Refactor effects to use inject() (#4080)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikiwanekhyland authored and swapnil-verma-gl committed Oct 14, 2024
1 parent 88276e6 commit 3fcbcc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
17 changes: 7 additions & 10 deletions projects/aca-content/src/lib/store/effects/library.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -44,13 +44,10 @@ import { NotificationService } from '@alfresco/adf-core';
@Injectable()
export class LibraryEffects {
private notificationService = inject(NotificationService);

constructor(
private store: Store<AppStore>,
private actions$: Actions,
private content: ContentManagementService,
private contentApi: ContentApiService
) {}
private store = inject(Store<AppStore>);
private actions$ = inject(Actions);
private content = inject(ContentManagementService);
private contentApi = inject(ContentApiService);

deleteLibrary$ = createEffect(
() =>
Expand Down
9 changes: 5 additions & 4 deletions projects/aca-shared/store/src/effects/router.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
() =>
Expand Down

0 comments on commit 3fcbcc0

Please sign in to comment.