Skip to content

Instantly share code, notes, and snippets.

@nogtini
Created April 18, 2018 17:55
Show Gist options
  • Save nogtini/fdf7076f9628a125a43a714815ca4e8d to your computer and use it in GitHub Desktop.
Save nogtini/fdf7076f9628a125a43a714815ca4e8d to your computer and use it in GitHub Desktop.
PizzaOrder component connecting to Interactors and Selectors
import {PizzaOrderSelectors} from '@themes/PizzaOrder/PizzaOrder.selectors';
import {PizzaOrderInteractors} from '@themes/PizzaOrder/PizzaOrder.interactors';
ngOnInit() {
this.userName$ = this.store.select(PizzaOrderSelectors.selectUserName);
this.pizzaTopping$ = this.store.select(PizzaOrderSelectors.selectPizzaToppings);
this.pizzaCrustType$ = this.store.select(PizzaOrderSelectors.selectPizzaCrustType);
this.deliveryEstimate$ = this.store.select(PizzaOrderSelectors.selectDeliveryEstimate);
this.driverName$ = this.store.select(PizzaOrderSelectors.selectDriverName);
this.driverCarType$ = this.store.select(PizzaOrderSelectors.selectDriverCarType);
}
displayModal() {
this.store.dispatch(new PizzaOrderInteractors.DisplayModal());
}
addTopping(topping) {
this.store.dispatch(new PizzaOrderInteractors.AddTopping(topping));
}
addCrustType(crustType) {
this.store.dispatch(new PizzaOrderInteractors.AddCrustType(crustType));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment