6

I'm building an application where I have different pages with lists of movies. E.g. search page (movies by search), actor's page (movies by actor), genre's page (movies by genre). The thing is all of them share the same basic functionality - load a list of movies by some criteria. I have a reducer for storing movies entities once something is loaded. But the problem is I have to create a separate reducer for each page type to save relevant movie ids to display.

Originally, I simply implemented all of those pages from scratch while duplicating a lot of code - separate actions, effects, reducers for each page. Now I feel that it's quite ugly and could be done in a neater way.

I already have a well-generalised queryMovies function in my service that queries movies by the options parameter.

Could you suggest any good way of organising such code?

EDIT:

Since this post was deleted, I cannot comment or reply (only edit). So I'm adding this link as part of an edit: https://github.com/johnpapa/angular-ngrx-data

And I think this is a great question and would like to see more of a discussion on appropriate architectures/patterns for ngRx.

Richard Matsen
  • 20,671
  • 3
  • 43
  • 77
  • *Could you suggest any good way of organising such code?* This alone makes this question both too broad, and primarily opinion based. Off topic for SO. – R. Richards Feb 27 '18 at 20:57

0 Answers0