Skip to content

Instantly share code, notes, and snippets.

@brakmic
Created April 11, 2017 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brakmic/f24e57d5fa64a43223d088cb96cdd453 to your computer and use it in GitHub Desktop.
Save brakmic/f24e57d5fa64a43223d088cb96cdd453 to your computer and use it in GitHub Desktop.
handling customer effects
@Injectable()
export class CustomerEffects {
@Effect() customerSelected$: Observable<Action> = this.actions$
.ofType(CustomerActionTypes.SELECTED)
.map(action => {
let customer: ICustomer = _.cloneDeep(action.payload);
customer.active_debt = this.paymentService.activeDebt(customer.id);
customer.picture = this.imageService.imageUrl(customer.id);
return this.customerActions.customerInitialized(customer);
});
constructor(private store: Store<IAppState>,
private actions$: Actions,
private customerActions: CustomerActions,
private paymentService: PaymentService,
private imageService: ImageService) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment