i cant move the filter operator outside the map with a condition
return this.http.get('profili/usermenu')
.pipe(
map((menu: Menu[]) => {
if (this.appConfig.config.DisableRitiriDetails)
menu = menu.filter(item => !item.Description.includes('xxx'));
const menuCreated: SidenavItem[] = this.menuSrv.populateMenu(menu);
this.router.navigate([menuCreated[0].routeOrFunction]);
return new MenuSuccess(menuCreated);
}),
catchError(() => of(new LoginError(3)))
);
something like
return this.http.get('profili/usermenu')
.pipe(
filter((menu: Menu) => this.appConfig.config.DisableRitiriDetails || !menu.Description.includes('xxx')),
map((menu: Menu[]) => {
const menuCreated: SidenavItem[] = this.menuSrv.populateMenu(menu);
this.router.navigate([menuCreated[0].routeOrFunction]);
return new MenuSuccess(menuCreated);
}),
catchError(() => of(new LoginError(3)))
);
in this way it gives me error to the map((menu: Menu[])