The tasks this code is trying to accomplish are these in order
Im trying to listen for an action
take the payload for that action
pass that payload to a database service function
pass the payload to a success reducer action
The data is supposed to be getting saved to Indexeddb in the browser but keeps giving me an error saying its being provided a null value which is not true.
what could be causing a null value to be passed?
@Effect()
public createCampaign$ = this.actions$.pipe(
ofType(ActionTypes.CREATE_CAMPAIGN),
map((action: CampaignActions.CreateCampaignAction) => action.payload),
switchMap((payload) => this.databasService.addCampaign(payload).then(() => Promise.resolve(payload).then(item => item))),
map((campaign) => (new CampaignActions.CreateCampaignSuccessAction(campaign)))
)