Created
July 8, 2016 10:17
-
-
Save kazagkazag/93762f1831ad3cc3410170f971c44e80 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
| // action types | |
| // import types from 'actionTypes.js' | |
| function accounts(state = [], action) { | |
| switch(action.type) { | |
| case types.ADD_ACCOUNT: | |
| return [ | |
| ...state, | |
| { | |
| id: getNewId(), //fake method that returns new ID | |
| title: action.title, | |
| createdBy: action.createdBy | |
| } | |
| ]; | |
| case types.DELETE_ACCOUNT: | |
| return deleteAccountByID(action.id); //fake method that returns new array of accounts without specified one | |
| default: | |
| return state; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment