starter.dev-github-showcases
starter.dev-github-showcases copied to clipboard
[Angular - NgRx - SCSS] Create mapping functions for parsing data between API response and store
Currently, each effect file in the store is mapping the data from the service calls into the shape we want for the state. We'd like to refactor these mappings out into their own file, and let the effects use the mapping to help the effects look cleaner.
You can see an example of this in the state/user
file - a user.mapping.ts
file has been created with the mapping functions, and then the user.effects.ts
file is using those mappings. This ticket will cover the work to do the same thing in the other state files - create a .mapping.ts
file to hold the functions, and update the related effect to use those functions.
If an effect's mapping is 3 lines or less, that can likely stay in the effect. If it's larger or more deeply nested than that, please create a mapping function for it.