Created
January 18, 2019 19:46
-
-
Save baetheus/a812da61eb686eddbe3ba3a9e8a9c2c6 to your computer and use it in GitHub Desktop.
Example action + reducer + lens + epic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Get Campaigns | |
| */ | |
| export const getCampaigns = contactStrategyActionFactory.async<number, Campaign[], Error>('GET_CAMPAIGNS'); | |
| export const campaignsLens = Lens.fromProp<ContactStrategyStore, 'campaigns'>('campaigns'); | |
| const getCampaignsReducer = reducerFactory(getCampaigns, campaignsLens); | |
| const getCampaignsEpic: Epic = a$ => | |
| a$.pipe( | |
| filterSwitchAsync(getCampaigns, companyId => from(GetCampaigns({ companyId }).then(({ campaigns }) => campaigns))) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment