Use ADF Notification Service instead of NgRx store (#3991)

This commit is contained in:
Denys Vuika
2024-08-07 18:33:39 -04:00
committed by GitHub
parent 2d5b9ea708
commit 9455269ca8
18 changed files with 202 additions and 233 deletions

View File

@@ -22,21 +22,21 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { Node, PathInfo } from '@alfresco/js-api';
import { map } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { AppStore } from '../states/app.state';
import { Location } from '@angular/common';
import { NavigateUrlAction, NavigateRouteAction, NavigateToFolder, NavigateToParentFolder, NavigateToPreviousPage } from '../actions/router.actions';
import { SnackbarErrorAction } from '../actions/snackbar.actions';
import { RouterActionTypes } from '../actions/router-action-types';
import { NotificationService } from '@alfresco/adf-core';
@Injectable()
export class RouterEffects {
constructor(private store: Store<AppStore>, private actions$: Actions, private router: Router, private location: Location) {}
private notificationService = inject(NotificationService);
constructor(private actions$: Actions, private router: Router, private location: Location) {}
navigateUrl$ = createEffect(
() =>
@@ -143,7 +143,7 @@ export class RouterEffects {
this.router.navigate(link);
}, 10);
} else {
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.CANNOT_NAVIGATE_LOCATION'));
this.notificationService.showError('APP.MESSAGES.ERRORS.CANNOT_NAVIGATE_LOCATION');
}
}