Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
talks$ = createEffect(() =>
this.actions.pipe(
navigation(TalksAndFiltersComponent, {
run: (r: ActivatedRouteSnapshot) => {
const filters = createFilters(r.params as any);
return this.backend
.findTalks(filters)
.pipe(map(talks => TalksActions.talksUpdated({ talks, filters })));
},
onError: (r: ActivatedRouteSnapshot, error) => {
console.error('Error', error);
throw error;
}
})
)
);
talk$ = createEffect(() =>
this.actions.pipe(
navigation(TalkDetailsComponent, {
run: (r: ActivatedRouteSnapshot, state: TalksPartialState) => {
const id = +r.paramMap.get('id');
if (!state.talks.entities[id]) {
return this.backend
.findTalk(+r.paramMap.get('id'))
.pipe(map(talk => TalksActions.talkUpdated({ talk })));
} else {
return of();
}
},
onError: (r: ActivatedRouteSnapshot, error) => {
console.error('Error', error);
throw error;
}
})