Created
October 11, 2016 00:59
-
-
Save cloudscape-germany/5dc4026007a0c3ea3a4e0c15c0adfe05 to your computer and use it in GitHub Desktop.
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
| import { ActionReducer, Action } from "@ngrx/store"; | |
| import { ActionType } from "./action-type"; | |
| import { PurchaseModel } from "../purchase/purchase.model"; | |
| export const currentPurchase: ActionReducer<PurchaseModel> = (state:PurchaseModel = new PurchaseModel(), action:Action) => { | |
| switch (action.type) { | |
| case ActionType.SET_PURCHASE: | |
| return (action.payload !== null) ? action.payload : new PurchaseModel(); | |
| case ActionType.UPDATE_PURCHASE: | |
| return Object.assign({}, state, action.payload); | |
| default: | |
| return state; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment